Notification listeners let you programmatically observe and act on various events that occur within the SDK in Optimizely Feature Experimentation.
- Give you flexibility in implementing custom integrations with analytics providers.
- Enable integrations by passing data to external services.
Here are a few examples for using notification listeners:
- Send data to an analytics service and report feature flag decision data, for example, report that user_123 was assigned to variation A.
- Use SDK events to send alerts to data monitoring tools like New Relic and Datadog to visualize better how A/B tests affect service-level metrics.
- Pass all events to an external data tier, like a data warehouse, for additional processing and to leverage business intelligence tools.
- Re-initialize your SDK to quickly retrieve updated feature flag configuration data for your business-critical features.
The listeners work by triggering a callback function that you define and provide at runtime.
The following methods or lifecycle events trigger notification listeners if you have implemented the listener:
For notification listeners triggered by older methods such as Is Feature Enabled and Activate, see an earlier version of this page.
|Method||Notification listener invoked|
|Decide methods||Invoke the DECISION notification listener if this listener is enabled.|
|Track Event||Invokes the TRACK notification listener if this listener is enabled.|
Important! This method will not call the TRACK notification listener when the specified event key is invalid
|SDK Lifecycle event||Notification listener invoked|
|event batch flushed||Invokes the LOGEVENT notification listener if this listener is enabled|
|new datafile retrieved||Invokes the OPTIMIZELYCONFIGUPDATE notification listener if this listener is enabled.|
For more information about each listener type, see:
Decision notification listener
Log event notification listener
optimizelyConfig update notification listener
Track notification listener
Updated 4 months ago