Audiences give you control over which users are included in a rollout and have access to your feature. You'll describe which users to include based on custom attributes like their location, device type, or subscription plan. After you create an audience, you can add it to your feature.
A single audience is defined based on user attributes. These attributes are properties of a user that you pass in when calling APIs like 'IsFeatureEnabled'. When you pass attribute values, Optimizely uses them to determine whether the user qualifies to see the rollout.
- Navigate to Audiences > Attributes.
- Click New Custom Attribute.
- Enter a key for the attribute.
- Click Save.
Note: Attribute keys must be unique within your account. For example, an attribute for visitors located in the United States might be called "US_VISITOR". You can pass attributes to the SDK in your code, so always make sure to update your code with any changes made to your keys.
- If you have a consumer application with multiple users, and you'd like to serve the feature user by user, consider making the unique identifier that is associated with an individual user in your application an attribute in Optimizely (ex:
- If you have a business application that has multiple customers or accounts and want to serve the feature customer by customer, consider making the unique identifier that is associated with an individual customer in your application an attribute in Optimizely (ex:
You can pass in attributes, including strings, numbers, booleans, and null as user attribute values in a 3.0 SDK. For further details, check out Pass in attributes in our developer documents.
Build an audience
After you've created a few attributes, you can start building audiences. Audiences help you target your feature to certain groups of users. You can reuse audiences that you've created across multiple features.
Rollouts supports several match types that you can use in audience conditions:
has any value
String contains substring
Boolean is false
Boolean is true
Number is less than
Number is greater than
The Edit Audience window lets you define audience conditions by either dragging and dropping attributes from the right side pane or defining complex JSON objects using the Code Mode window.
To drag and drop attributes:
- Navigate to Audiences > Saved.
- Click Create New Audience.
- Drag and drop the desired attributes into the Audience Conditions field.
For example, to create an audience of visitors who are located in the US, based on specific location values, add the "LOCATION" attribute.
- Define the attributes.
Add other attributes to help create your audience. They can be can be added as "and" or "or" 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, at minimum.
- Click Save Audience.