Target audiences
Describes how to build and target specific audiences in Optimizely Feature Experimentation.
Audiences give you control over which users can access your flag rules, for example, A/B tests, targeted deliveries, or multi-armed bandit optimizations.
A single audience is defined based on custom user attributes you create. These can be based on location, device type, subscription plan, and so on. When you call user-based methods like Decide
and Track
, Optimizely Feature Experimentation determines whether a user qualifies for a flag by evaluating the attributes.
Create an audience
After you have created and implemented a few attributes, you can start building audiences. You can reuse audiences that you create across multiple flags and rules.
Audience match conditions
Optimizely Feature Experimentation supports several match comparison operations that you can use in audience conditions:
has any value
String equals
,String contains substring
String equals
is the only match type that is compatible with SDK version releases before March 2019 (pre-3.0.0 releases for most major SDKs). See the SDK Compatibility Matrix.
Boolean is false
,Boolean is true
Number equals
,Number is less than
,Number is less than or equal to
,Number is greater than
,Number is greater than or equal to
- For SDK version compatibility with "or equal to" comparisons, see the SDK Compatibility Matrix.
Version equals
,Version is less than
,Version is less than or equal to
,Version is greater than
,Version is greater than or equal to
- See the SDK Compatibility Matrix for SDK version compatibility.
- You can use
version
to target audiences based on the version of your application that they use. You must implement the attribute in your code by passing in your application's semantic version specifications as a string to Optimizely Feature Experimentation.- You can pass versions in the format
"major.minor.patch-prerelease+build"
, wherepatch
,prerelease
, andbuild
are optional. For example, you can pass"3.0"
or"1.5.1-beta"
or"2.0.5-alpha+001"
.
- You can pass versions in the format
While attributes are not explicitly typed in Optimizely Feature Experimentation, you must pass in values of the correct type and format for your audience conditions to evaluate correctly. An attribute value of the incorrect type will result in a false-y audience evaluation.
The Edit Audience window lets you define audience conditions by dragging and dropping attributes from the side panel or defining complex JSON objects using the Code Mode window.
Build audiences from attributes
To create audiences from attributes:
-
Go to to Audiences > Saved.
-
Click Create New Audience.
-
Drag and drop your previously created attributes into the Audience Conditions field.
-
Select the match condition. See the Audience match conditions section.
-
Add other attributes to create your audience. They can be added as
and
oror
conditions.Note
When you choose any match type option other than
String equals
for exact matching, a message displays that the option requires using an SDK version of 3.0.0 or higher for most SDKs. See SDK Compatibility Matrix. -
Click Save Audience.
After creating an audience, you can set the target audience or audiences for flag rules.
Create audience combinations
When adding your audience to a flag, you can use and
or or
operators (any
or all
) to create a combination of other audiences.
-
From Flags, click or create a flag.
-
Select or create a rule.
-
Under Audiences, select an audience.
-
Add another audience. Adding more than one audience per rule creates an audience combination.
-
From the Matchdrop-down list, select any or all:
If you want to use more complex nested logical operators with and
or not
, you can do so in JSON in Code Mode. See Create advanced audience combinations.
Advanced audience information
Excluding audiences
You can use audiences to include users but not exclude them.
For example, you cannot exclude "all Desktop users" by dialing back traffic to 0% for that audience. This is because if you toggle off audience evaluation for Desktop users, they end up in the "Everyone" audience.
To actually exclude or blocklist audiences, you can define advanced audience combinations with not
using Code Mode. For information, see Create advanced audience combinations.
Overlapping audiences
If you define multiple, overlapping audiences and multiple rules for a single flag, then how a single user successively evaluates against the rules can get complicated. For information, see Interactions between flag rules.
Nested logical operators
If you want to use nested logical operators (and
, or
, not
) to create audience combinations, you can do so in Code Mode. Each audience is a rule like User likes salads
, and an audience combination is a boolean combination of these rules, like User likes pizza NOT (User likes sandwiches AND User likes soup)
.
For information, see Create advanced audience combinations.
Updated 6 months ago