Skip to main content

We are currently experiencing an issue that is preventing customers from submitting support tickets. Please contact us at (866) 819-4486 if you need immediate assistance.

x
Optimizely Knowledge Base

Mobile Attributes

THIS ARTICLE WILL HELP YOU:
  • Create an attribute in Optimizely
  • Use the attributes API to capture user data
  • Target experiments to those users
  • Segment their results on the Results Page

This article will show you how to create attributes, which add visitor information through the API, and use them to filter your results.

What are attributes? 

Your users are not all the same.  They differ by region, device, and other important attributes. Optimizely stores data about every user, like when they arrived, what device they use, and which version of your app they use. Each type of information that Optimizely collects is called an attribute.

For example, you can create an attribute for "plan type" that includes the values basic, plus,and premium. Or an attribute for "favorite food" that includes the values pizza, hamburger, and sushi.

Use attributes to segment your experiment results for more insight. This allows you to drill down into experiment results and discover how certain segments of users are behaving differently. This will allow you to create future experiments targeted to them.

Attributes are available only to Enterprise customers. If you don’t see the feature in your Optimizely account, or want to learn more about what’s available, please refer to our pricing matrix.

Viewing attributes 

You can view all attributes that you have created by going to the Home page and clicking the Attributes tab.

mobile attributes tab

Attributes require Optimizely SDK version 1.5 or higher. If you do not see attributes in your project Home page, you may need upgrade your SDK and start your app.

Creating attributes 

Customers with Enterprise plans can use the attributes API to report extra data about their users. When you create a new an attribute, it will apply to all your users going forward, but not retroactively.

Currently, Optimizely allows you to create up to 10 custom slots (depending on plan type) for filtering your results. These slots can include:

  • Audiences that you want to use to segment results
  • Attributes added through the API

You can use any combination of audiences or attributes for filtering your results, but you have a limit of 10 slots that can be used.

To create a new custom dimension, go to the Home page and click the Overview > Attributes tab.

Attributes tab 2

Clicking Attributes shows you a list of all your attributes. You can create new attributes by clicking New Attribute.

Clicking New Attribute brings up the following dialog:

From this dialog, give your attribute a name and description that you'll use to identify the attribute in Optimizely and click Save. You can also optionally give the attribute a name for the API call, instead of the attribute ID. For more information, see the next section.

Giving users an attribute

In your app’s code, you'll want to bind the attributes API call to logic or an action that indicates that the user should be added to the attribute with a certain value.


In iOS:

[Optimizely setValue:@"attributeValue" forAttributeApiName:@"attributeApiName"];

Or:

[Optimizely setValue:@"attributeValue" forAttributeId:@"1234567890"];

 

In Android:

Optimizely.setValueForAttributeApiName("attributeValue", "attributeApiName");

Or:

Optimizely.setValueForAttributeId("attributeValue","1234567890");

In Android, if you call setValue before startOptimizelyWithAPIToken, you need to pass in the current app context:

Optimizely.setValueForAttributeApiName("attributeValue", "attributeApiName", getApplicationContext());

When using the Attributes audience condition, you must set the Attribute value prior to starting Optimizely. Otherwise, your users will not meet the audience condition until the second time they open the app.

Target your users by attribute

Once you have created your attribute, it will be available as an audience condition. Drag it into your audience to define the value a user must have for your attribute in order to see the experiment.

Viewing results by attribute

On Optimizely's Results page, you can drill into results for a specific audience or attribute by choosing from the Segment: dropdown.  Click the specific audience or attribute for which you wish to see results, and the results will refresh with specific data.