Skip to main content

Everything you need to switch from Optimizely Classic to X in one place: See the Optimizely X Web Transition Guide.

Optimizely Knowledge Base

Create audiences and attributes in SDK projects

There are two versions of Optimizely
What version do you have?
Optimizely Classic
This is what the Optimizely Classic user interface looks like.
Optimizely X
This is what the Optimizely X user interface looks like.
. If you're using Optimizely Classic Mobile, check this article out instead.
  • Optimizely X Full Stack
  • Optimizely X Mobile 
  • Optimizely X OTT

  • Determine which users can be included in an experiment based on certain qualities about them (attributes)
  • Create new audiences for experiments in SDK projects
  • Create new attributes and use them to define your audiences

You can use audiences to define a group of users based on conditions that you specify, then target your experiments to one or more audiences. For example, you might want target your experiment to users with a certain language setting. Or, you might show an experiment to users on certain devices only.

In Optimizely X, audiences are reusable across multiple experiments, but limited to each SDK project.

See additional resources
Here are all our articles about the Optimizely dashboard, which you'll use to create projects, add collaborators, manage privacy settings, and more: 

Here's our developer documentation, where you'll find code samples, full references for our SDKs, and getting started guides.


Audiences are composed of one or more user attributes. In Optimizely X, you can quickly create attributes and use them to define new audiences. Use the Audiences dashboard to create and manage attributes and audiences.

Unlike Optimizely X Web projects, experiments in SDK projects don’t include “out-of-the-box” attributes such as browser, device, or location. Optimizely’s SDKs are platform-agnostic, so we make no assumptions about what attributes are available in your application or their format. This requires some setup, but gives you full flexibility to customize attributes for targeting and segmentation.

If you want to use attributes, you need to pass them in the SDK—check out user attributes in our developer docs for details.

You do not need to pass audiences through the SDK. Optimizely infers audiences based on the attributes passed in the SDK.

Read on to create attributes and audiences for experiments in SDK projects.

Create an attribute

You'll use attributes to build the audiences that see your experiments. Here's how to create a new attribute.

  1. In the Audiences dashboard, navigate to the Attributes tab.

  2. Then, click New Custom Attribute.

  3. Name the attribute key. Attribute keys must be unique within your project.

    For example, an attribute for the user agent be called USER_AGENT.

    You can pass attributes to the Optimizely SDK in your code, so always make sure to update your code with any changes made to your keys.

  4. Click Save. 

Congratulations, you've created a new custom attribute! Use the Attributes tab to manage all your user attributes.

Create an audience

Once you've created a few attributes, you can start building audiences.

Audiences help you target your experiments to certain groups of users. In Optimizely X, you can reuse audiences that you've created across multiple experiments, but they’re limited to each SDK project.

  1. Navigate to the Saved tab of the Audiences dashboard.

  2. Click Add an audience.

  3. Drag and drop the attribute into the Audience Conditions field.

    For example, to create an audience of users who are searching from a mobile web device, based on specific values in the user agent, add the USER_AGENT attribute.

  4. Then, define the attribute.

    Add other attributes to help create your audience. They can be can be added as "and" or "or" conditions. Currently, only string attributes are available, and the audience builder includes only exact matching.

  5. Click Save Audience.

Now you can use these audiences when building experiments, and reuse them as needed! 

Attributes are used for segmentation on the Results page. If you define attributes and pass them in the SDK, they'll be available as segmentation options from the drop-down menu at the top of the Results page.