UTM parameter targeting

Create experiences that persist across your visitor's journey.

UTM parameter targeting allows you to target your Optimize experience at a specific utm_campaign and have it persist while a visitor navigates your website.

Related targeting types:

  • Google Ads targeting – target accounts, campaigns, ad groups, and keywords from Google Ads and have it persist while a visitor navigates your website.
  • Query parameter targeting – target query string values other than UTM parameters.

When to use UTM parameter targeting

Use the UTM parameter targeting type when you want to select visitors arriving with a specific UTM campaign value in the URL for an experiment or a personalization. Optimize will persist the UTM campaign value a visitor arrived on for 24 hours. This enables you to show an Optimize experiment or personalization to such visitors even if they navigate away from the landing page and then return to it later without the UTM campaign value in the URL. Another use for UTM parameter targeting is when you want to show an Optimize experiment or personalization on a page deep within your site instead of the first page they land on.

EXAMPLE 1
 
You can run an optimize experiment or personalization on www.example.com/home.html and it will be visible to visitors who have utm_campaign=spring_sale in the URL when they land on www.example.com/home.html. The experience will continue to be available to these visitors even after they've left the page and return to it later without the utm_campaign=spring_sale in the URL.
EXAMPLE 2
 
You can run an optimize experiment or personalization on www.example.com/checkout.html and it will be visible to visitors who have utm_campaign=spring_sale in the URL when they land on www.example.com/home.html and then find their way to www.example.com/checkout.html, at which point they will not have utm_campaign=spring_sale in the URL.

How persistence works

Optimize uses persistence to preserve your visitor's UTM campaign parameter as they move around your website.

Learn more about the types of cookies Optimize uses on the Analytics DevSite.

Same session

If a visitor arrives on a landing page and gets included in an experience using one of the campaign targeting types, the visitor will still see the experience if they navigate to other pages and return to the landing page again.

If an experience with campaign targeting is running on a page other than the landing page, the campaign information will still persist and the experience will be applied on that other page once visited, as long as all other targeting conditions are met. This will be the case even when there are no experiences targeting the landing page.

Cross session

If a visitor goes back a landing page in a different session, but within 24 hours of the first visit with a campaign parameter, they will still see the experience. So, persistence is across sessions, or cross session.

If a visitor returns to the page running the experience in a different session – but within 24 hours of their first visit – they will still see the experience. They will see the experience even if their second visit didn't have the campaign parameter in the URL.

Note: the 24-hour clock is refreshed when the user revisits the page with the same campaign parameter in the URL.

When does persistence begin?

For UTM parameter targeting, persistence begins when a visitor arrives on a web page that has Optimize installed and an active experience (either scheduled or running) with UTM parameter targeting. Said another way, persistence begins when you have an experience with utm_campaign targeting and a visitor lands on the site with a non-empty utm_campaign query parameter.

Note: The visitor doesn't have to match the condition for persistence to begin. For example, an Optimize experience targeting utm_campaign=spring_sale will persist the UTM parameter for any visitors that arrive on pages with this container and any UTM parameter query parameter. A match need not have occurred for persistence to start.

For Google Ads targeting, the visitor has to match the specific targeting condition in one of the experiences for the Google Ads IDs to persist.

When does persistence end?

A visitor's last utm campaign is reset 24 hours after the most recent visit from that campaign type. If the visitor arrives on any page from a different ad campaign or utm_campaign their corresponding last campaign parameter will be updated.

The visitor will no longer see the experience for a campaign 24 hours after his last landing on the site with the campaign value set. If the visitor lands on the site again with the same campaign within 24 hours, the expiration of that campaign is extended by another 24 hours.

The visitor will no longer see the experience for a campaign if the visitor lands on the site with a different campaign for the same type. For UTM parameter targeting, this happens when a visitor lands on the site with any non-blank utm_campaign query parameter.

The last value of a campaign type may still be stored in client storage for up to 24 hours after all experiences using that campaign type have stopped.

EXAMPLE 1
 
If Experience A is targeting utm_campaign=a and Experience B is targeting utm_campaign=b any visitor arriving with utm_campaign=a sees Experience A. Ten minutes later, if an Experience A user arrives from a new campaign (utm_campaign=b) they won't see Experience A from that moment forward, they'll see Experience B instead.
EXAMPLE 2
 
If a user sees Experience B, leaves your site, and returns two minutes later (even with no UTM parameter) they'll see Experience B, because their prior campaign persisted.

Target a UTM parameter

To target your Optimize experience at a UTM parameter:

  1. Create an experience.
  2. Select UTM parameter during targeting.
  3. Configure your UTM parameter settings.

Optimize UTM parameter targeting menu

UTM parameter settings

The next step is to enter your UTM parameter settings:

  1. Variableutm_campaign is selected by default.

  2. Match typeequals is selected by default.

  3. Value(s) – enter the value of the UTM parameter you wish to target.

Optimize UTM parameter targeting settings

Example

The UTM parameter in the screenshot above is created with the following condition:

 

Variable Match type Value
utm_campaign equals spring_sale

 

This condition will evaluate true if:

  • the value of the first matching utm_campaign (unescaped) equals spring_sale.

This condition will evaluate false if:

  • there are no utm_campaigns that equal spring_sale.

Check your rule

Optimize includes a convenient condition checker that allows you to enter a URL to verify whether the condition(s) above it will apply. Enter a full URL (copied from your browser’s location bar) in the Enter URL field then click ADD. If the condition you created above applies to the URL, you’ll see a green checkmark next to it. If the condition doesn't apply to the URL, you’ll see a red circle with a line through it.

To ensure that a condition applies to visitors of your regular website (http://) and your SSL website (https://) simply use the “or…” section of the condition builder to add a second URL for your SSL website. Then the condition will apply to visitors of both URLs.

Match types

The following match types are available in UTM parameter targeting:

Equals / does not equal

Every character in your UTM parameter from beginning to end, must be an exact match of the entered value for the condition to evaluate as true. A condition using does not equal will evaluate as true when the utm_campaign does not equal any of the entered values.

Example 1:

Use campaign targeting to reach visitors from the spring_sale UTM parameter:

Variable Match type Value
utm_campaign equals spring_sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=spring_sale
Variable Match type Value
utm_campaign does not equal spring_sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=summer_sale
  • https://www.example.com/store/landing?utm_campaign=holiday_sale
  • https://www.example.com/store/landing.html

Example 2:

Use campaign targeting to reach visitors from any UTM parameter:

Variable Match type Value
utm_campaign does not equal undefined

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=winter
  • https://www.example.com/store/landing?utm_campaign=summer

Will evaluate false for:

  • https://www.example.com/store/landing.html

Contains / does not contain

The contains match type (also known as a "substring match") allows you to target any occurrence of a substring with a longer string. Contains is useful when targeting a UTM parameter that appears in multiple URLs.

Example:

Variable Match type Value
utm_campaign contains spring_sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=spring_sale_na
  • https://www.example.com/store/landing?utm_campaign=spring_sale_emea
  • https://www.example.com/store/landing?utm_campaign=spring_sale_apac
Variable Match type Value
utm_campaign does not contain spring_sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=summer_sale
  • https://www.example.com/store/landing?utm_campaign=holiday_sale
  • https://www.example.com/store/landing.html

Starts with / does not start with

The starts with match type matches identical characters starting from the beginning of the query string up to and including the last character in the string you specify. Use the starts with match type when your query parameters are generally unvarying but can include strings at the end that you want to exclude.

Example:

Variable Match type Value
utm_campaign starts with spring_sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=spring_sale_na
Variable Match type Value
utm_campaign does not start with spring_sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=summer_sale

Ends with / doesn't end with

An exact match of the entered value with the end of the URL. You can target utm_campaigns that end with sale.

Example:

Variable Match type Value
utm_campaign ends with sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=spring_sale
Variable Match type Value
utm_campaign does not end with sale

Will evaluate true for:

  • https://www.example.com/store/landing?utm_campaign=summer_sale

Operators

OR

The OR operator is useful for targeting one kind of page with multiple URL configurations. Conditions using the OR operator will evaluate as true when any of the values are met. You can use OR by adding additional values in a URL targeting rule. When targeting URLs, OR is automatically appended to your first URL after pressing return. Simply type additional URLs (followed by return) to continue building conditions with the OR operator.

Example:

To target website visitors arriving from utm_campaign=spring_sale or spring_email, create a rule with two site search in the Value field. You'll notice that OR is automatically added after you press enter.

Variable Match type Value
utm_campaign equals spring_sale or... spring_email

 

The OR operator is supported within individual conditions but you can't use it to combine multiple conditions. For example, you can build a condition like this: "path equals /store OR /shop" but you can't use OR across multiple conditions like this: "path equals /store OR host equals example.com"

Was this helpful?
How can we improve it?