Optimizely will be sunsetting Full Stack Experimentation on July 29, 2024. See the recommended Feature Experimentation migration timeline and documentation.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Decision notification listener

This topic describes the DECISION notification listener which sends a stream of all feature flag decisions.

Description

The DECISION notification listener sends a stream of all feature flag decisions. 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 impression-emitting decisions, you can use the deprecated ACTIVATE notification listener.

To track feature usage:

  1. Sign up for an analytics provider of your choice (for example, Segment)
  2. Set up 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. However, the DECISION notification listener is covered below.

Parameters

The following tables show the information provided to the listener when it is triggered:

FieldTypeDescription
typestringDecision type varies depending on which method triggers the listener.

See type parameter.
decision infomapKey-value map that consists of data corresponding to the decision and based on the type.

See type parameter and decision-info parameter.
user IDstringThe user ID.
attributesmapA 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.

The following tables shows details about the parameters for the DECISION notification listener.

type parameter

The following table shows how the type parameter populates with the following values depending on which method triggers the DECISION notification listener:

Triggering methodmethod sets type field to:
isFeatureEnabledfeature
getEnabledFeaturesreturns feature decision for each active feature
getFeatureVariablefeature variable
getAllFeatureVariablesall feature variables
activateeither feature test or ab test depending on the experiment type
getVariationeither feature test or ab test depending on the experiment type

decision info parameter

The following table shows how the decision info parameter populates, depending on the decision type provided to the notification when triggered:

decision info parameter contents depending on typefeaturefeature-variableall-feature-variablesab-testfeature-test
feature key
String id of the feature.
feature enabled
True or false based on whether the feature is enabled for the user.
source
String denoting how user gained access to the feature. Value is:
- rollout if the feature became enabled or disabled for the user because of the rollout configuration associated with the feature.
- feature test if the feature became enabled or disabled because of a feature test.
source info
Contains experiment and variation keys
experiment keyN/A, available in source info instead.N/A, available in source info instead.N/A, available in source info instead.
variation keyN/A, available in source info instead.N/A, available in source info instead.N/A, available in source info instead.
variable key
Feature variable key
variable type
Feature variable type
variable value
Feature value for the specified user (default if user doesn't qualify for experiment)
variable values Contains the response of the Get All Feature Variables method, i.e. dictionary of all key-value feature variables for the feature flag.

Examples

For example code, see the notification listener topic in your SDK language.