Track notification listener
The track event method triggers this notification listener. Because the Feature Experimentation SDKs queue and batch events, there can be a delay between when the track event method captures an event and when the event is actually sent to Feature Experimentation as part of a batch. For more precise alignment with event batches, see Log event notification listener.
Parameters
The following table lists the information provided to the track notification listener when it is triggered:
field | type | description |
|---|---|---|
event key | String | The event key as you defined it in the Optimizely app. |
user id | String | The user ID. |
attributes | Map | A map of custom key-value string pairs specifying attributes for the user that are used for audience targeting. Non-string values are only supported in the SDK v3.0.0 and above for most SDKs. See SDK compatibility matrix. |
event tags | Map | A map of custom key-value pairs specifying tags for the tracked event. For information, see Tag events. |
event | Event | The event object contains the id, key and experiment ids. |
Examples
For code examples, see the following SDK documentation on notification listeners:
- JavaScript SDK – SDK versions 6.0.0 and later.
- JavaScript (Browser) SDK – SDK versions 5.3.5 and earlier.
- JavaScript (Node) SDK – SDK versions 5.3.5 and earlier.