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

Audience conditions: Descriptions and examples

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 provides more detail about each condition, and some 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 campaigns and New vs. Returning Visitors audience conditions.

Available audience conditions vary based on your Optimizely plan type. If what you see doesn’t match what’s in this article, or you want to learn more about what’s available, please refer to our pricing matrix.

 
Tip:

If you're looking for how to find the Audiences menu, or a high-level overview of the conditions, read our Audience overview article.

Ad campaigns

Available on select Enterprise plans.

This 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 will let you drill down into campaign keywords such as “holiday_sale”.

Unlike the query parameter condition, the Ad campaign condition is "sticky."

You have a few options for how to target certain ad campaigns:

  • Choose equals from the dropdown if you want to target an exact utm_campaign value
  • Choose contains from the dropdown if you want to target any utm_campaign 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
  • Choose has any value from the dropdown if you want to target any ad campaign, regardless of what the value is.

For a more in-depth overview of how you can optimize based on ad campaigns, see our article on optimizing SEM campaigns.

 
Note:

This 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 all Optimizely plans.

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

An alternative to targeting based on browser type is to use the Custom JavaScript targeting option

Example: exclude visitors who are viewing the experiment with Internet Explorer.

You have an experiment that doesn't render correctly in Internet Explorer, so you want to make sure that visitors using that browser don't see the experiment.

  1. Select Browser / Version, then Visitor is not using any of these browsers.
     
  2. Choose Internet Explorer (any version) from the drop down. This will exclude all visitors viewing the URL on any version of Internet Explorer.

Cookie

Available on select Enterprise plans.

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 or not. You also have a few options for how to target certain cookie values:

  • Choose equals from the dropdown if you want to target an exact cookie value
  • Choose contains from the dropdown 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 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 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.

An alternative to targeting based on cookies is to use the Custom JavaScript targeting option.

Example: exclude visitors who have previously seen a certain promotion.

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.

  1. Identify how you're going to differentiate between visitors who have and have-not seen the promotion.
     
  2. Select Cookie, then Visitor does not have any of these cookies.
     
  3. 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.
 
Example: include only logged-in customers.

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”.

  1. Identify how you are going to differentiate between logged-in and logged-out customers.
     
  2. Select Cookie, then Visitor has any of these cookies.
     
  3. 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 select Enterprise plans.

You can set audiences based on whether or not the visitor has already triggered a custom event goal in Optimizely. This information gets stored in the local storage of the visitor's browser, and 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 deduplicated, meaning that an event either exists in the localStorage once, or not at all.

Custom JavaScript

Available on select Enterprise plans.

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 article.

Custom Tags

Available on select Enterprise plans.

Custom Tags allow you to set audiences based on unique information about a visitor or a page.

Learn more in our Custom Tags article.

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 table 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 table but not one of the specified models(iPhone, iPad, etc) on the UI then the device is considered an "other mobile"

Available on all Optimizely plans.

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.

Example: exclude visitors viewing the experiment on a mobile phone.

You have a responsive website and 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 want to exclude visitors using a mobile phones from your experiment.

  1. Select Device, then Visitor is not using any of these devices.
     
  2. Choose iPhone from the drop down. Then click the green + button and select Other mobile phone from the dropdown.
     
  3. This will exclude all visitors who are viewing the specified URL on a mobile phone.

DCP: Dynamic Customer Profiles

Available on select Optimizely 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 enables 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.

Has Universal User ID

You can set audiences based on whether or not the user has a Universal User ID set. More information on what this ID is and how it can be useful can be found in our dedicated article.

IP Address

Available on select Enterprise plans.

You can set audiences based on the IP address of the visitor to your webpage. When you select this feature, you will be presented with a condition box and a choice of four matching rules to choose from: Exact match, Prefix match, Regular expression, and CIDR Notation.

  • Exact Match: This option is just what it sounds like; the visitor's IP address must match what is in the box exactly for the targeting condition to be true. Therefore, a full IP address must be entered.
  • Prefix Match: This option 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: This is an advanced type of match and allows you to get very specific in terms of the matching conditions for your visitors. Visit this page for more information on using regular expressions.
  • CIDR Notation: This is another 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.

The IP audience condition gets its information from Akamai just like the Location audience condition. See this section in our Locations (geotargeting) for information.

Language

Available on all Optimizely plans.

Since browsers store their preferred language choice (e.g. en-us), you can set audience conditions by language preference. If your plan does not include geotargeting, this feature in effect lets you target by country. Note, however, that someone's browser may be set to prefer one language (en-us, for the United States) but they may actually be living in another country (en-gb, for Great Britain). Unless your target audience is expats, this should be pretty rare.

Location, or Geotargeting

Available on select Enterprise plans.

Location (also known as "Geotargeting") is the ability 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.

Then select your location from the drop-down.

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 close to a city but in a suburb may be identified as coming from the city, or vice versa.

Mobile visitors are also often identified as coming from a location different from where they actually are, since their internet traffic is routed according to their service provider. A visitor accessing a site on her phone from Livermore, CA, may appear to come from Sacramento, CA, for example, depending on the specifics of their service provider. Mobile visitors can be excluded by selecting the Browser or Device condition.

If for some reason the visitor's geographic information cannot be determined, they will not match any locations. This means that they will not see the experiment, if you are targeting specific locations. If you are targeting to exclude locations, however, they will still see the experiment.

 
Important:

The use of Geotargeting may cause page flashing, because the script that obtains the IP + location information of the visitor runs asynchronously.

New vs. Returning Visitors

Available on all Optimizely plans.

 
Note:

This 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 targets experiments towards new or returning visitors to a page where your Optimizely snippet is implemented.

Please note that this condition has 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 all Optimizely plans.

This condition allows you to create audiences based on what 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.

Example: include visitors using iOS.iOS.

You are running a promotion for a new mobile app you are launching for iOS and you only want to show the promotion to visitors that are using iOS.iOS and you only want to show the promotion to visitors that are using iOS.

  1. Select Platform / OS , then Visitor IS using any of these of these platforms.
     
  2. Choose iOSiOS (any version) from the dropdown. This will include all visitors who are viewing the specified URL from a device running any version of iOS.iOS.

Query Parameters

Available on all Optimizely plans.

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 a few 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.

For a more in-depth example of how you can use query parameter Audience targeting to deliver more value from your SEM/ad campaigns, see our article on optimizing based on SEM campaigns.

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.

Example: Include visitors coming from an ad campaign.

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”.

  • 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:

    1. Select Visitor matches any of these query parameters.
       
    2. Add “utm_campaign” in the left input field as the parameter name.
       
    3. Select has any value from the dropdown.

  • If you do care what the value of the query string parameter is, e.g. “utm_medium=cpc” then follow the steps above, but choose equals from the dropdown, then enter the value of the query parameter:

  • Feel free to add as many query parameters as needed.

Referrer URL

Available on all Optimizely plans.

One of the targeting options found in Optimizely is to trigger an experiment based on the URL that your visitors came from. This is commonly known as the referrer.

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



Example
: exclude visitors coming from a promotional third party site.

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.

  1. Identify which URL sources should be excluded from the experiment.

  2. 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.

  3. 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.

Example: include visitors coming from a search engine.

You are running an experiment to provide targeted content to visitors arriving from common search engines.

  1. Identify which search engines should be included in the experiment.

  2. 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.

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

Advanced Setup:

For more advanced referrer targeting you can even capture a given search term that led the visitors to your page. This would require limiting the URL match to a Regular Expression (regex) match to capture the search terms as provided by the various search engines. Please note that this will work for Yahoo and Bing, but not Google, because Google does not use the 'q' parameter. The example below shows what this might look if you were interested in targeting an experiment for any visitor that came to your page by entering the keyword of "example" into their search engine:

Time/Day of Visit

Available on select Enterprise plans.

This condition targets experiments to visitors during certain day/time frames. Times can be specified down to the minute, or all day, and they correspond to the visitor's local timezone.

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

Traffic Source

Available on select Enterprise plans.

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.

 
Note:

The “source type” audience condition, with the exception of campaign, is based on the document.referrer value in the browser. Your visitors’ “source type” values may change as they navigate your site.

So, for example, if your site's flow includes a step where visitors leave the page, go to a 3rd party site or different subdomain, and then come back to your site, then after they come to your site, they will count as a 'referral' and be included in your experiment if it is targeted towards 'referral' visitors. Be mindful of using this targeting condition if your site includes such a step.

Uploaded Audience

Available on select Optimizely 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, we have an entire article on Uploaded Audience Targeting.