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:
- 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 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:
Field | Type | Description |
---|---|---|
type | string | Decision type varies depending on which method triggers the listener. See type parameter. |
decision info | map | Key-value map that consists of data corresponding to the decision and based on the type .See type parameter and 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 the 3.0 SDK and above. |
The following tables shows details about the parameters for the DECISION notification listener.
type
parameter
type
parameterThe following table shows how the type
parameter populates with the following values depending on which method triggers the DECISION notification listener:
Triggering method | method sets type field to: |
---|---|
isFeatureEnabled | feature |
getEnabledFeatures | returns feature decision for each active feature |
getFeatureVariable | feature variable |
getAllFeatureVariables | all feature variables |
activate | either feature test or ab test depending on the experiment type |
getVariation | either feature test or ab test depending on the experiment type |
decision info
parameter
decision info
parameterThe 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 type | feature | feature-variable | all-feature-variables | ab-test | feature-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 key | N/A, available in source info instead. | N/A, available in source info instead. | N/A, available in source info instead. | ✓ | ✓ |
variation key | N/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.
Updated almost 3 years ago