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 listenerLog 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 targetingaudience targeting. Non-string values are only supported in the SDK v3.0.0 and above for most SDKs. See SDK compatibility matrixSDK compatibility matrix. |
event tags | Map | A map of custom key-value pairs specifying tags for the tracked event. For information, see Tag eventsTag 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:
- Android SDKAndroid SDK
- C# SDKC# SDK
- Flutter SDKFlutter SDK
- Go SDKGo SDK
- Java SDKJava SDK
- JavaScript SDKJavaScript SDK – SDK versions 6.0.0 and later.
- JavaScript (Browser) SDKJavaScript (Browser) SDK – SDK versions 5.3.5 and earlier.
- JavaScript (Node) SDKJavaScript (Node) SDK – SDK versions 5.3.5 and earlier.
- PHP SDKPHP SDK
- React SDKReact SDK
- React Native SDKReact Native SDK
- Ruby SDKRuby SDK
- Python SDKPython SDK
- Swift SDKSwift SDK