Google Optimize (replacing the deprecating Google Content Experiments) is, at its core, an A/B testing platform. A/B testing is nothing new, so what makes Google Optimize so special?

How about seamless integration with Google Analytics and Google Tag Manager to help provide a cohesive network of three powerful platforms that allow for more advanced targeting, more advanced reporting, and more advanced conversion tracking, all within an intuitive, user-friendly interface?

Oh yeah and it’s completely free.

Going beyond general targeting

Figuring out what you want to test may seem like the most important part of an experiment, whether it’s a simple A/B test that tests a new promotional button, or perhaps a redirect test that experiments with variations of two different ‘Thank You’ pages.

Now all you have to do is split that experiment traffic 50% to the original and 50% to your variation, and hit ‘Start Experiment’..phew!


By fine-tuning your targeting options from the typical 50% split of your entire traffic, you can begin to deliver test variations to your users in a more thoughtful and effective way.

Before you split your traffic, here are some things to think about:

  • How your website is accessed:
    • Devices
    • Browsers
    • Time of day
    • Referral channels
  • Marketing campaigns
  • First time customers
  • Repeat customers
  • Visitors in different phases of the buying cycle.
  • International visitors

Now ask yourself, are my experiments appropriately aimed at the right audience?

It’s time to get granular…

The pre-launch experiment question to ask yourself:

Who do I want to target this experiment to, and when do I want it to happen?

When you know the answer to that question, you can rest assured that Google Optimize will be able to pull it off.

Rules? Where we’re going we don’t need rules!

Actually, we do. Rules are the essential building blocks of Google Optimize targeting. I just really wanted to make that pun.

Google Optimize doesn’t make it immediately apparent, but there are some very advanced targeting rules available to you.

Here’s how to create a new rule:

To create a new rule, scroll all the way to the bottom of the Targeting tab for any new experiment.

Create Rule

Find and click the greyed out button that reads + CREATE RULE

You should now see a pane of targeting options appear on the right, waiting to be selected.

Optimize Targeting Types

You can target any page on your site, any geographic region, and some very specific user behaviors. The fun really happens when you begin to combine multiple rules, allowing for really targeted experimentation.

For example, you can choose to only show your experiment variations to first time visitors referred from a specific website at a specific time of day, or you can choose to only render experiment variations on a mobile device if they have had a product in their cart after a certain amount of time.

On top of all that, Google Optimize integrates effortlessly with the powerful Google Tag Manager, allowing you to utilize even more options using the data layer and Tag Manager features.

The only real limitation here McFly is your imagination.

Google Optimize Targeting Types

So let’s take a look at all of the different types of targeting that Google Optimize can work with (click to skip down to a description of each):

  • URL Targeting – Target the specific URLs where your experiments run.
  • Behavior Targeting – Target new vs. returning visitors or those coming from specific referrers.
  • Geo Targeting – Target visitors from a specific city, metro, region or county.
  • Technology Targeting – Target visitors using a specific device, browser or OS.
  • JavaScript Variable Targeting – Target a JavaScript variable in the source code of the webpage.
  • Custom JavaScript Targeting – Target pages based upon a value returned by custom JavaScript.
  • First-Party Cookie Targeting – Target users that have a first-party cookie from your website.
  • Query Parameter Targeting – Target specific pages and sets of pages with query parameters.
  • Data Layer Variable Targeting – Target based on key values stored in the data layer.
  • Audience Targeting – Target Audiences created in Google Analytics. (Only available to Optimize 360 users).

URL Targeting

Here are all the variables and rules that apply to URL targeting:

URL Targeting VariablesMatch type
URL (default)The full document.location of a page. URL is the building block of Optimize targeting conditions, and is extremely flexible when combined with match types and operators.HostCommonly referred to as the “domain” or “domain name.” Used to target a variant to all pages on your site.PathThe portion of the URL following the host/domain name that doesn’t include query parameters.URL fragmentA portion of a URL.matchesequalscontainsstarts withends withmatches regexdoes not equaldoes not containdoes not start withdoes not end withand does not match regex

Behavior Targeting

Behavior targeting is useful for targeting first time visitors to your site, allowing you to test things such as a new sign-up or registration variant to users who have never been to your website before.

Here are all the variables and rules that apply to behavior targeting:

Behavior Targeting VariablesMatch type
Time since first arrivalTarget users who first came to your site within a given time period. The arrival time is set when Google Analytics sets a cookie for a user. This only occurs on the user’s first visit to your site or if the user does not currently have a GA cookie from your site.less thangreater than
Behavior Targeting VariablesMatch type
Page ReferrerTarget visitors that arrive from specific channels or sources that you specify.matchesequalscontainsstarts withends withmatches regexdoes not equaldoes not containdoes not start withdoes not end withand does not match regex

Geo Targeting

Use Geo targeting to target users from a particular geographic area. For example, you might invite users from a specific city to attend an in-person event or to visit your retail location. While typing in the Values field, you’ll see suggestions from the AdWords Geographical Targeting API to help speed rule creation.

Here are all the variables and rules that apply to geo targeting:

Geo Targeting VariablesMatch type
CityRegionMetroCountryequalsdoes not equal

Technology Targeting

Optimize looks at the browser’s user agent string to identify which browser is being used, what version, and on which operating system. You can use these data as targeting criteria in Optimize.

Here are all the variables and rules that apply to technology targeting:

Technology VariablesMatch type
BrowserOperating SystemDevice Categoryequalsdoes not equal
Technology VariablesMatch type
Mobile Device Infomatchesequalscontainsstarts withends withmatches regexdoes not equaldoes not containdoes not start withdoes not end withand does not match regex

Javascript Variable Targeting

Use this type of targeting if you can find the value you’re looking for in the source code of the webpage, in the form of a JavaScript variable.

Information such as product, cart and page details are often stored in JavaScript variables. Optimize can serve experiments based on these values using JavaScript variable targeting.

If the only way to retrieve the information you need is from a JavaScript variable, use JavaScript variable targeting. However, be aware that if the JavaScript variable you’re referencing is deleted, or if the name of the variable changes, your targeting condition will no longer work. For this reason, it’s best to use JavaScript variable targeting only when the other targeting rules won’t work for what you want to test.

Example: Let’s say we want to target visitors whose cart value is between $90 and $100 with different variations of a free shipping promotion, to see which one converts better. Let’s assume the following:

  • The minimum purchase required to get free shipping is $100.
  • You store your customer’s cart value in a variable on your checkout page.

Let’s go ahead and Create a new variable:

  • First enter your global javascript variable name, for example:
    • cartTotal.
  • Name your new variable – for example
    • Cart total value.

Then simply click the ‘Create Variable’ Button.

Note: A variable name may also refer to a variable nested in an object (e.g. ““)

After creating your custom variable, Optimize will populate it in a new targeting condition which you can complete by adding a match type and value. For this example, we will build two JavaScript variable conditions joined by AND, found on the main Targeting tab.

First we create our variable ‘Cart total value’ greater than 90 .

Click Add.

Now, we click ‘AND’:

To complete our condition we simply choose our variable named ‘Cart total value’ again, and this time setting the value to less than 100.

Click Add

Now when the cart_total variable returns the value of your visitor’s shopping cart. The targeting criteria in the example will evaluate as true when the user has between $90 and $100 worth of merchandise in their shopping cart.

Here are the rules that you can apply to your javascript variable targeting:

Javascript VariableMatch type
Custommatchesequalscontainsstarts withends withmatches regexdoes not equaldoes not containdoes not start withdoes not end withand does not match regex

Custom Javascript Targeting

Custom JavaScript targeting allows you to inject JavaScript on to a page, then target your experiments based on the value that the JavaScript returns.

  • Use custom JavaScript when you want to build targeting conditions based on webpage information that can’t be retrieved from the URL, the data layer, JavaScript variables, or other targeting.
  • Your custom JavaScript must be a single JavaScript function that returns a value using the ‘return’ statement. You can then target visitors based on the value that your JavaScript returns.

Always be cautious with JavaScript code that will have side effects. Your code shouldn’t alter/update the DOM or any variables currently stored on the page.

Example: Target visitors browsing your site in the morning

Let’s say you want to target experiments to users visiting your site during the morning hours. To do this, write a JavaScript function that returns the current hour (with possible values 0-23).

function() {
return (new Date()).getHours();

Let’s call this ‘Browser Time’:

Then, simply create a targeting condition that looks for a returned value that is less than 12 (noon):

Here are the rules that you can apply to your custom javascript targeting:

Custom JavascriptMatch type
Custommatchesequalscontainsstarts withends withmatches regexdoes not equaldoes not containdoes not start withdoes not end withand does not match regex

Cookie targeting is frequently used to check whether or not a user is logged-in, but it can also be used to retrieve the value of any first-party cookie that you set in the visitor’s browser.

When your experiment is running and is targeted to a particular cookie value, Optimize checks the first-party cookie in the visitor’s browser, allowing you to target a specific set of users with your experiment. Awesome!

Additionally, if you URI-encode the value of a cookie, simply check the URI-decode cookie checkbox during rule creation. This allows you to safely store an arbitrary string in the cookie value. For example, if you want to store a cookie value of a=b you would URI encode it as a%3Db because equals (=) is not a valid cookie value character.

Here are the rules that you can apply to first party cookie targeting:

First Party CookieMatch type
Custommatchesequalscontainsstarts withends withmatches regexdoes not equaldoes not containdoes not start withdoes not end withand does not match regex

Query Parameter Targeting

Query parameter targeting explicitly targets values that occur in the query string of a URL. Query parameters are found between the question mark (?) and in some cases the hash mark (#), for example:


Query parameters in the above examples include:

  • Google Analytics campaign parameters (?utm_campaign=fall), and
  • Search queries (?q=nexus).

URLs can contain multiple query parameters, called query components. The first occurs after the question mark (?), and subsequent components occur after the ampersand (&). The following URL includes three query components:


Example: Let’s target visitors who searched for a specific product or word on your internal site search.

You want to target an experiment at visitors who search for pricing on your website. Let’s say that these internal site searches generate the following URL structure:


We first enter our query key, in this case it would be ‘q’, let’s name this ‘Search Query’.

After we have created that custom variable, Optimize will populate it in a new targeting condition which we can now complete by adding a match type and value.

This condition will evaluate true if the value of the first matching query component contains pricing. If no query components contain pricing, the condition will evaluate false.

Here are the rules that you can apply to query parameter targeting:

Query Parameter TargetingRules
Custommatchesequalscontainsstarts withends withmatches regexdoes not equaldoes not containdoes not start withdoes not end withand does not match regex

Data Layer Variable Targeting

Let’s say you want to create a targeting condition that references shopping cart data or other information available on the page.

For example, you might want to target users who are about to purchase a certain product or who just completed a purchase worth more than $100. Instead of retrieving the product ID or purchase amount from JavaScript variables, you could store this information in the data layer and retrieve it there.

Tip: Data layer variables are per-page only, not per-session. When used across multiple pages, you should either declare your data layer variables on every page, or use a cookie.

Example: Let’s say you want to target and show variations of a promotion to high-value visitors (we’ll define that as those who have orders greater than $100).

To build a targeting condition based on order value, you’ll need to have a key-value pair within the data layer that you can reference.

In the following example, purchaseTotal contains the order value of 451:

dataLayer = [{
‘purchaseTotal’: 451

To create a rule targeting the purchaseTotal in the data layer, you need to create a new custom variable, then build a condition with it.

After we add our data layer variable name, and give it a simple descriptive name, (we’ll simply call this one Purchase total), then we can utilize it with a match types and a value.

Now we can target users who have triggered our data layer variable:

Audience Targeting

Currently only available to the premium users of Optimize 360.This feature allows you to focus your experiment on a group of users who have exhibited specific behaviors on your site. For example, you can target users interested in a specific product category to see if a customized home page increases conversions. You can also create Audiences in Google Analytics for users who have converted recently, who convert frequently, or who spend a lot of time on your website, and then target them from within Optimize.

Level up: Go build a time machine out of a DeLorean

These targeting types on their own have the power to really level up your experimentation, so when you take into account that you can combine a multitude of these targeting types too, then you can really start to build some wildly focused tests.

So, before you deploy any experiment, look at your current user behavior in Google Analytics. You may be building experiments with variations that could be even more effective after you understand who and when to target.