This article will help you:
  • Target experiments based on data you have about your visitors using custom tags

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

You may wish to run an experiment on a group of pages that are not easily captured by a substring or regular expression in URL targeting. Consider a group of product pages with the URLs:

You can configure your experiment to run on product pages by adding a Custom Tag to all of the product pages, and then targeting that tag in your Optimizely experiment. 

Alternatively, you may wish to run an experiment based on attributes unique to the visitor. Consider an experiment for an online newspaper that wants to target articles in the sports section, or an experiment for a dating site can target only female visitors.

Custom tags are available only on select Optimizely Classic packages. To gain access to custom tags, contact your Customer Service Manager or email

To send Optimizely this information for targeting, you need to use the “customTags” API call before the snippet loads. For example, this is how a news site may tag its articles by category:

window['optimizely'] = window['optimizely'] || [];
window['optimizely'].push(["customTag", "article type", "sports"]);</script>
<script src="//">

For more details about the API call, you can read the documentation

You also have a few options for how to target certain custom tags:

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

The Tag field specifies the key of the tag to match (e.g. “article type”). You can match any specific string (e.g. “sports”) or select has any value from the dropdown to match any value.

The fields will autocomplete based on the custom tags Optimizely has detected on the experiment page. You can also freely enter custom tags that aren't yet available on the experiment page (for instance if you are waiting on the code to change). In this case the experiment will run only once the tags become available.


Custom segmentation is not compatible with audiences based on custom tags. To create a similar custom segment for your results, dimensions can be used instead.