Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev guideRecipesAPI ReferenceChangelog
Dev guideAPI ReferenceRecipesChangelogUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Decision notification listener

Describes the decision notification listener, which sends a stream of all feature flag decisions for OptimizelyFeature Experimentation.

The decision notification listener 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

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, complete the following:

  1. Sign up for an analytics provider of your choice (for example, Segment).
  2. Configure a decision notification listener.
  3. Follow your analytics provider's documentation and send events from within the decision listener callback.

Steps 1 and 3 are not covered in this documentation.

Parameters

The following table shows the information provided to the listener when it is triggered:

Field

Type

Description

type

string

Decision type varies depending on which method triggers the listener.

The decide methods set the type to flag.

decision info

map

Key-value map that consists of data corresponding to the decision. See decision-info parameter.

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 SDK versions 3.0 and above (released after March 2019) for most SDKs. See SDK compatability matrix.

decision info parameter

The following table shows the decision info parameter of the decision notification listener:

Decision info parameter

Description

flag key

The flag key.

enabled

Boolean value for whether the flag is enabled or not.

variables

The same object as returned by my_decision.variables.

variation key

The key of the flag variation.

rule key

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 Experimentation Results page corresponds to a dispatched decision event.

experiment ID

Experiment assignment ID.

variation ID

Variation assignment ID.

Examples

For code examples, see the following SDK documentation on notification listeners: