The DECISION notification listener sends a stream of all feature flag decisions. It is triggered by the Decide methods. It is most commonly used to send decisions to an analytics provider or to an internal data warehouse to join it with other data that you have about your users. Note that if you only want decisions that resulted in impressions in the Optimizely app, you can filter on the dispatched decision event field of the returned OptimizelyDecision object in your code.
To track flag usage:
- Sign up for an analytics provider of your choice (for example, Segment).
- Set up a DECISION notification listener.
- Follow your analytics provider's documentation and send events from within the decision listener callback.
Steps 1 and 3 aren't covered in this documentation. However, the DECISION notification listener is covered below.
The following tables show the information provided to the listener when it is triggered:
Decision type varies depending on which method triggers the listener.
The Decide methods set the type to
Key-value map that consists of data corresponding to the decision. See decision-info parameter.
The user ID.
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 3.0 SDK and above (released after March 2019).
The following table shows the decision info parameter of the DECISION notification listener:
The flag key
Boolean value for whether the flag is enabled or not.
The same object as returned by my_decision.variables
The key of the flag variation
The key of the flag rule
decision event dispatched
A boolean value indicating if the decision dispatched a decision event to logx.optimizely.com. In the Optimizely app, an impression on the Results page corresponds to a dispatched decision event.
For example code, see the notification listener topic in your SDK language.
Updated over 1 year ago