Skip to main content
menu_icon.png

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

x
Optimizely Knowledge Base

Audience conditions: Descriptions and examples

relevant products:
  • Optimizely X Web Experimentation
  • Optimizely X Web Personalization
  • Optimizely Classic

This article will help you:
  • Use Audience conditions to customize who will be included in your experiments, such as: 
    • Visitors who use certain devices, like phones or tablets
    • Visitors in certain locations
    • Visitors who come from certain ad campaigns or who use certain query parameters
    • Visitors who have certain cookies, like logged-in

When you set up Audiences to target certain visitors in your experiment, you'll build those audiences using certain conditions. This article describes each audience condition, including common ways to use them to target certain visitors.

Most default audience conditions aren't "sticky," meaning the condition is re-evaluated for the visitor on each new page load. For example, a visitor may meet the targeting conditions and be included in the experiment early on. If she returns later, maybe with a different browser or language setting that doesn't meet the experiment's audience conditions, she'll no longer be included in the experiment. The exceptions to this rule are the Ad Campaign and New/Returning Session conditions.

Available audience conditions vary based on your Optimizely plan type, so they're organized by plan type in this article. For an overview of available audience conditions and other plan-specific features, please refer to our pricing matrix.

All Optimizely plans

Ad Campaign

Available on Optimizely X and Optimizely Classic.

The Ad Campaign condition allows you create audiences based on 'utm_campaign' campaign source types. Visitors who arrive with the parameter 'utm_campaign' will capture the parameter value as a dimension, up to a 20-character maximum (longer values will be truncated). This lets you drill down into campaign keywords such as “holiday_sale.”

You have several options for how to target certain ad campaigns:

  • Choose equals if you want to target an exact 'utm_campaign' value

  • Choose contains if you want to target any 'utm_campaign' value that contains the string that you enter (similar to substring match in URL targeting)

  • Choose matches if you want to target a value using a Regular Expression

  • Choose has any value if you want to target any ad campaign, regardless of what the value is

For example, if you want to include visitors from the "spring_15" 'utm_campaign' value, select Visitor comes from any of these ad campaigns and the contains targeting option, and enter spring_15 in the text field:

For details about how you can optimize based on ad campaigns, see our article on optimizing SEM campaigns.

 
Note:

The Ad Campaign audience condition is "sticky." In other words, if a visitor lands on a page with a query parameter from an ad campaign and gets targeted in the experiment, the targeting will persist after the initial page viewed. The Ad Campaign condition is ideal for tracking visitors across multiple pages.

After a visitor is initially bucketed into an experiment using the Ad Campaign condition, Optimizely will place this information in the browser's localStorage so that the visitor continues to be targeted, even after they move to other pages on the site.

Browser/Version

Available on Optimizely X and Optimizely Classic.

The Browser/Version condition targets your experiment based on a visitor's browser or browser version. You can include or exclude visitors who are using specific browsers or versions of browsers.

For example, suppose your experiment doesn't render correctly in Internet Explorer. You can use the Browser/Version audience condition to exclude visitors who are browsing in any version of Internet Explorer from the experiment:

An alternative to targeting based on browser/version is Custom JavaScript targeting.
 

Device

We use an open source javascript called UAParser, https://github.com/faisalman/ua-parser-js/tree/0.7.9, to define the device type. NOTE: Mobile and non-mobile segments on the results page are not defined using UAParser.

How "Other Tablet" and "Other Mobile" is defined:

  • Other tablet- If the device is a tablet but not one of the specified models(iPhone, iPad, etc) on the UI then the device is considered an "other tablet"

  • Other mobile -If the device is a tablet but not one of the specified models(iPhone, iPad, etc) on the UI then the device is considered an "other mobile"

Available on Optimizely X and Optimizely Classic.

Optimizely allows you to target your experiment based on device types. You can choose to include or exclude visitors who are using a specific device. Optimizely detects different devices based on the user agent provided by the visitor's browser, so this condition is not evaluated based on device width or screen width.

For example, if you have a responsive website, you might want to test adding a large image to your landing page. You know that adding an image to the page will not easily scale for smaller screens, so you can use the Device audience condition to exclude all visitors who are using a mobile phone from your experiment:

Language

Available on Optimizely X and Optimizely Classic.

Since browsers store their preferred language choice, such as "en-us" (for US English), you can set audience conditions by language preference. If your plan does not include geotargeting, this feature effectively lets you target by country:

However, this assumes that a visitor's language preference will correspond with their location. For example, an US citizen might have his browser set to prefer "en-us" even though he's actually living in Brazil.

New/Returning Session

Available on Optimizely X and Optimizely Classic.

The New/Returning Session condition targets experiments towards new or returning visitors to a page where your Optimizely snippet is implemented:

 
Note:

The New/Returning Session audience condition is "sticky." This condition is session-based, meaning that the first time someone goes to a domain where your Optimizely snippet is implemented, they will be considered "new" for the remainder of the session (generally, this means until they close their tab/browser).

For a new visitor, this audience condition is also “sticky” for the duration of that sessionIn future sessions, those visitors will become "returning" visitors and thus won't be targeted as "new" visitors.

When interpreting and segmenting results, note that even if a visitor is counted as "new" and later returns as a "returning" visitor, that visitor will count in the "new" segment.

This condition changed as of the release of Audiences. Previously, it was not session-based. Experiments using our old new/returning functionality, before audiences were released, will not migrate automatically to audiences.

Platform/OS

Available on Optimizely X and Optimizely Classic.

The Platform/OS audience condition allows you to create audiences based on the platform or operating system a visitor is using. Target visitors based on whether they are on mobile or desktop, or if they are using a specific operating systems like Windows or OS X.

For example, if you're running a promotion for a new mobile app that you are launching for iOS and you only want to show that promotion to visitors that who are using iOS, you can use this audience condition to include all visitors who are viewing the specified URL from a device running any version of iOS:

Query Parameters

Available on Optimizely X and Optimizely Classic.

URLs can contain a lot of information, and one of the most common components is the query string. Query strings contain many pieces of information, and they can be used in Optimizely to personalize your experiments. The most common use case for setting audiences based on query parameters is targeting your experiment for paid ads and search engine marketing (SEM) campaigns. 

You also have several options for how to target certain query parameters:

  • Choose equals from the dropdown if you want to target an exact query parameter value

  • Choose contains from the dropdown if you want to target any query parameter value that contains the string that you enter (this is similar to substring match in URL targeting)

  • Choose matches from the dropdown if you want to target a value using a Regular Expression (note, at this time, Optimizely does not support flags.)

  • Choose has any value from the dropdown if you want to target based on the presence of a query parameter, regardless of what the value is.

Query parameter targeting is case-sensitive for both names and values. If you need your query parameter targeting to be case-insensitive, please contact support or let us know in the Optiverse Community.

Query parameter conditions will not continue to include a visitor in an audience if the visitor returns to the page without the query parameter. In a multi-page experiment, the visitor will fail targeting conditions if they navigate to another page in the experiment without the query parameter that is used in the audience condition.

Let's say you want to test changing a search widget for visitors who are arriving at the page from SEM campaigns. You know that your desired audience will have a query parameter “utm_medium=cpc”.

First, identify the name and value of the query string parameter you care about. Is the value always guaranteed to be the same, or will it change? Are you looking for specific value, or will any value work?

If experiment should run for all visitors with “utm_campaign” present in the URL, but the value does not matter, select Visitor matches any of these query parameters, add “utm_campaign” in the left input field as the parameter name, and select has any value from the dropdown:

If you do care what the value of the query string parameter is, such as “utm_medium=cpc”, follow the same steps, but choose equals from the dropdown and enter the value of the query parameter:

Add as many query parameters as needed:

For a more in-depth example of how you can use query parameter audience conditions to deliver more value from your search engine marketing (SEM) and ad campaigns, see our article on optimizing based on SEM campaigns.

Referrer URL

Available on Optimizely X and Optimizely Classic.

The Referrer URL audience condition option allows you to trigger an experiment based on the URL that your visitors came from. This is commonly known as the referrer.

The behavior on Optimizely Classic and Optimizely X are not the same. Click here to learn more. 

Typical use cases include setting audiences by the search engine they use, or excluding certain promotional referrers. The match types used for Referrer URL audience conditions are the same as the match types used for URL targeting.



For example, suppose you are running several offers on popular discount sites. You want to run an experiment that tests adding promotional banners to your page, but you do not want the visitors coming from a discount site to see these alternate offers.

First, identify which URL sources should be excluded from the experiment. Then, select Visitor does not come from these URLs and add the specific page URL along with the appropriate match type. In this case, it would be a referral from a substring match to www.groupon.com and www.livingsocial.com:

This will ensure that the experiment will run for all visitors except for those who had been on a groupon.com or livingsocial.com page immediately prior to arriving at his site.

In another example, suppose you are running an experiment to provide targeted content to visitors arriving from common search engines.

First, identify which search engines should be included in the experiment. Select Visitor comes from these URLs and add the specific page URL along with the appropriate match type. In this case, it would be a referral from a substring match to google.com, yahoo.com, and bing.com:

This ensures that the experiment will run for all visitors who had been on Google, Yahoo, or Bing immediately prior to arriving at his site.

To learn how to use the Referrer URL audience condition to include visitors who came to your site by specific search terms, check out this article.

Traffic Source

Available on Optimizely X and Optimizely Classic.

This condition allows you to create audiences based on the source type in the browser: campaign, search, referral, or direct.

  • Campaign source type contains users that arrive on a URL containing a 'utm_campaign,' 'utm_source,' 'gclid,' or 'otm_source' query parameter; if the URL contains one of these parameters, the visitor will count as "Campaign" traffic even if they arrived through search

  • Search source type contains users that visit through a referral URL containing Bing, Google, Yahoo, or Baidu but NOT a specific campaign parameter (otherwise, they would be bucketed as "campaign").=

  • Referral source type includes all users that come from another URL that doesn't count as Campaign or Search

  • Direct source type includes all users who do not have any external referrer in their URL

These are the same as the source types found in Optimizely's default segments.

The Traffic Source source types (except campaign) are based on the document.referrer value in the browser. Your visitors’ source type values may change as they navigate your site.

For example, suppose your site's flow includes a step where visitors leave the page, go to a third-party site or different subdomain, and come back to your site. After they come back to your site, they will count as a referral and be included in your experiment if it is targeted toward referral visitors. Be mindful of using this audience condition if your site includes such a step.

 

Professional and Premium plans

Cookie

Available on Optimizely X and Optimizely Classic.

To target based on whether or not the visitor has a cookie from your site, enter the cookie's name. This will check whether that cookie is set. You also have several options for how to target certain cookie values:

  • Choose equals if you want to target an exact cookie value

  • Choose contains if you want to target any cookie that contains the string that you enter (this is similar to substring match in URL targeting)

  • Choose matches if you want to target a value using a Regular Expression (currently, Optimizely does not support flags)

  • Choose has any value if you want to target based on the presence of a cookie, regardless of what the value is

Cookie targeting is case-sensitive for both names and values. If you need your cookie targeting to be case insensitive, please contact support or let us know in the Optiverse Community.

The most common use cases for this condition include setting audiences by their logged-in state, and creating a test cookie to preview your experiment.

For example, if you're running a pop-up banner that highlights a new-user promotion. You want to run an experiment on this banner, but you also want to ensure that the experiment is only counting visitors for those who actually see the banner. You know that a cookie “seen_promo=true” is set on visitors when the pop-up appears.

First, identify how you're going to differentiate between visitors who have and have-not seen the promotion. Select the Cookie condition, then Visitor does not have any of these cookies. Add the cookie name (seen_promo) in the left input field and the cookie value (true) in the right input field:

The experiment will only run for visitors who do not have the cookie “seen_promo=true”. This means your test will only be seen by visitors who are seeing the promotion for the first time.

As another example, let's say you want to run an experiment with layout changes for customers who are logged in to your site. You know that logged-in customers have a cookie “logged_in=true”.

First, identify how you are going to differentiate between logged-in and logged-out customers. Select the Cookie audience condition, then Visitor has any of these cookies. Add the cookie name (such as "loggedIn") in the left input field and the cookie value (true) in the right input field:

The experiment will only run for visitors with the specified cookie that distinguishes them as being logged in.

In this case, a cookie is the differentiator, but it many cases, the "logged-in" state may be a variable on the page and you will need to use a custom JavaScript condition to do this.

Custom Events

Available on Optimizely Classic.

You can set audiences based on whether or not the visitor triggers a custom event goal in Optimizely:

This information gets stored in the local storage of the visitor's browser. You can track up to the past 100 unique events across your Optimizely projects to use for targeting.

If the number of unique events is greater than 100, the oldest custom event triggered will be discarded. Repeat custom events are de-duplicated, so an event either exists in the localStorage once, or not at all.

Custom JavaScript

Available on Optimizely X and Optimizely Classic.

Custom JavaScript conditions let you target complex and customized sets of visitors, based on conditions that you define. Just make sure that the condition evaluates to true. To learn more about Custom JavaScript, including use cases, see our Custom JavaScript audience targeting article.

Premium plans only

Custom Tags

Available on Optimizely Classic.

Custom Tags allows you to set audiences based on unique information about a visitor or a page. Learn more in our Custom Tags article.

IP Address

Available on Optimizely X and Optimizely Classic.

You can set audiences based on the IP address of the visitor to your webpage. When you select this feature, you will see a condition box and four matching rules to choose from:

  • Exact Match: The visitor's IP address must match what is in the box exactly for the targeting condition to be true (so you must enter a full IP address).

  • Prefix Match: Allows you to define the starting part of the visitor's IP address that must match. Any IP addresses that start with the same numbers as what's in the box should match.

  • Regular Expression: Advanced type of match that allows you to get very specific in terms of the matching conditions for your visitors. Visit this page for more information about using regular expressions.

  • CIDR Notation: Advanced type of match that allows you to express an entire subnet more capably than the other match types. If you are not familiar with CIDR Notation and have more advanced technical skills, you can read more about it in this article.

The IP Address audience condition information comes from Akamai, a global content delivery network.

Location

Available on Optimizely X and Optimizely Classic.

Location (also known as geotargeting) allows you to only run experiments for visitors coming from specific geographic locations.

To use this feature, start typing the name of a major city, country, state, region, or continent, and a drop-down will appear. Select your location from the drop-down:

You can also add more than one location:

With these targeting settings, the experiment will only run for visitors who come from these specific locations.

The geographic information comes from Akamai, a global content delivery network. This geographic information is derived from the source of the internet connection. This means that under certain conditions, the information may be slightly inaccurate. For example, a visitor who is in a suburb that's close to a city may be identified as coming from the city.

When using geotargeted audiences, Optimizely Classic will fire another pageview goal once geotargeting information is retrieved. This is to ensure that geotargeted users are properly tracked on the results page. However, this also means that some pageviews may be counted multiple times in the total results.

Mobile visitors are often identified as coming from a location that is different from where they actually are because their internet traffic is routed according to their service provider. For example, a visitor accessing a site on her phone from Livermore, California may appear to come from Sacramento, California, depending on how her service provider routes traffic. You can use the Device audience condition to exclude mobile visitors.

Visitors whose geographic information cannot be determined will not match any locations. This means that if you are targeting specific locations, these visitors will not see the experiment if you are targeting specific locations. However, if you are targeting to exclude locations, these visitors will see the experiment.

 
Important:

Using the Location audience condition may cause page flashing because the script that obtains the visitor's IP and location information runs asynchronously.

Time/Day of Visit

Available on Optimizely X and Optimizely Classic.

The Time/Day of Visit audience condition targets experiments to visitors during certain days and at certain times. Times can be specified to the minute or for the entire day, and they correspond to the visitor's local time zone.

Time/Day of Visit targeting will not continue to include a visitor in an audience if the visitor loads your page outside of the day or time frame. However, the visitor's conversions will count toward whichever variation they were exposed to, even if they convert outside of the day or time frame.

 

Select Optimizely X Web Personalization plans

Dynamic Customer Profiles (DCP)

Available on select Optimizely X Web Personalization plans.

A Dynamic Customer Profile (DCP) is a single, actionable view of your customer built from a combination of Optimizely behavioral data and your first- and third-party customer data. DCP allows you to create audience conditions based on information that you have about your customers, and create 1-1 personalization.

Learn about setting up Dynamic Customer Profiles in this article.

Uploaded Audience

Available on select Optimizely X Web Personalization plans.

This condition targets experiments based on a list of cookies, query parameters, or ZIP codes that you upload in a CSV file. For more information, check out this article on uploaded audience targeting.

 

Other 

Universal User ID

This is a deprecated feature that will sunset in 2017.

You can set audiences based on whether the user has a Universal User ID set. Check out this article for information about the Universal User ID and how it can be useful.