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

Referrer URL audience condition: Include and exclude visitors by search term

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

This article will help you:
  • Use the Referrer URL audience condition to include and exclude visitors in your experiments by search term

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

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 more advanced referrer targeting, you can capture a given search term that led the visitors to your page. This requires limiting the URL match to a Regular Expression (regex) match to capture the search terms as provided by the various search engines. 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 are interested in targeting an experiment for any visitor that came to your page by entering the keyword "example" into their search engine:

In Optimizely X, the recorded referrer URL is ultimate referrer or the originating URL. This can be further defined as the URL of a page outside the domain of the snippet that the visitor migrated from before landing on a page where the snippet is running.  

The referrer URL is defined by Optimizely at the time when a visitor first comes in contact with the snippet, not an experiment. Even if there is no experiment present at the time the visitor comes in contact with the snippet, the visitor object recognizes the URL from the previous domain page a visitor migrated from.

When troubleshooting this issue, use the visitor object from the JavaScript API: window["optimizely"].get("visitor");

Look under events to find what URL Optimizely has defined as the 'referrer' URL for the visitor: