Behavior targeting allows you to target first time users and visitors coming from a specific referrer.
When to use behavior targeting
Behavior targeting is useful for targeting first time visitors to your site. This allows you to test a new sign-up or registration variant to users who have never been to your website before. You can also use it to target visitors that arrive from the websites that you specify.
Variables
- Time since first arrival – Target users who first came on 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.
- Page Referrer – Target users arriving to your site from a specific channel or source.Use the Page Referrer variable to target users coming from specific websites and tailor your marketing to them.
Time since first arrival
Use the Time since first arrival variable to target new visitors to your site with a unique “first time user” experience, or incentivize them to register for an account and test your sign-up conversion goal. The Time since first arrival variable will evaluate true when the age of the visitor's Google Analytics cookie matches the condition that you create.
Example 1
Google Analytics usually sets its cookie shortly before the first hit or event to Analytics and Optimize is sent. You can therefore target an experiment to new users on the first page of their visit by specifying a short value for Time since first arrival. To target your experiment at new users, create a behavior targeting rule like this:
Variable | Match type | Number | Value |
Time since first arrival | less than | 10 | seconds |
Example 2
To target an experiment to any page that a new user visits in the first 60 minutes since they first arrived on your site, create the following behavior targeting rule:
Variable | Match type | Number | Value |
Time since first arrival | less than | 60 | minutes |
Page Referrer
When you deem a referring site as important, you can target visitors coming from that site with a personalized experience. For example, use Page Referrer to target users arriving from example.com with a promotion encouraging them to sign up for an account.
To target users coming to your site from example.com, create the following behavior targeting rule:
Variable | Match type | Value |
Page Referrer | contains | example.com |
Match types
The Time since first arrival variable uses the equals match type.
The Page Referrer variable uses the following match types: Equals, Contains, Starts with, Ends with, and Regex matches.
Equals
Every character in your URL, from beginning to end, must be an exact match of the entered value for the condition to evaluate as true. Use equals when you wish to target URLs that never contain dynamic (changing) information such as session identifiers or query string parameters.
Example:
Variable | Match type | Value |
Page Referrer | equals | http://www.example.com/ |
Will evaluate true for:
http://www.example.com/
Will evaluate false for:
https://www.example.com/
Contains
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 unique query string parameter that appears in multiple URLs.
Example:
Variable | Match type | Value |
Page Referrer | contains | page=4 |
Will evaluate true for:
http://www.example.com/member.cgi?id=9&page=4
Will evaluate false for:
http://www.example.com/member.cgi?id=9&page=2
Starts with
The starts with match type matches identical characters starting from the beginning of the string up to and including the last character in the string you specify. Use the starts with match type when your URLs are generally unvarying but can include query string parameters at the end that you want to exclude.
Example:
Variable | Match type | Value |
Page Referrer | starts with | http://www.example.com/pages/ |
Will evaluate true for:
http://www.example.com/pages/subpage/
Will evaluate false for:
http://www.example.com/members/pages/
Ends with
An exact match of the entered value with the end of the URL. You can target shopping cart pages that use /thankyou.html
at the end of their URLs.
Example:
Variable | Match type | Value |
Page Referrer | ends with | /thankyou.html |
Will evaluate true for:
http://www.example.com/checkout/thankyou.html
Will evaluate false for:
http://www.example.com/checkout/thankyou.html?x=1&y=1
Regex matches
A regular expression uses special characters to enable wildcard and flexible matching. Regex matches are useful when the stem, trailing parameters, or both, can vary in the URLs for the same webpage. If a user could be coming from one of many subdomains, and your URLs use session identifiers, you could use a regular expression to define the constant element of your URL.
Example:
Variable | Match type | Value |
Page Referrer | regex matches | checkout.cgi\?page=1 |
Will evaluate true for:
http://sports.example.com/checkout.cgi?page=1&id=123
http://fishing.example.com/checkout.cgi?page=1&lang=en&id=123
Will evaluate false for:
http://sports.example.com/checkout.cgi?page=2&id=123
Operators
AND
The AND operator is useful when you wish to target a variant based on multiple rules that all need to be true. Conditions using the AND operator will only evaluate as true when all of the values are met.
Example:
To target users visiting your /nexus_9
page, while browsing from a tablet, create two rules joined by the AND operator.
A URL targeting rule:
Variable | Match type | Value |
URL | equals | https://store.google.com/product/nexus_9 |
...and a Technology targeting rule:
Variable | Match type | Value |
Device Category | equals | tablet |
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 rules with the OR operator.
Example:
To target a store page which has two different URLs, create a rule with two URLs in the Value field. You'll notice that OR is automatically added after you press enter.
Variable | Match type | Value |
Page Referrer | equals | http://store.google.com/ or... http://www.google.com/store/ |
The Time since first arrival variable only uses the equals match type.
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"
Additional considerations
- Regex matches use the fully vetted match type descriptions from URL matching article once vetted.
- There are cases where the page referrer may be empty. For example, the visitor typed the URL directly into their browser or clicked on a bookmark. It is also not sent if the referring site is secure (HTTPS) and the page you are on is not secure (HTTP).
Related resources
Related targeting articles
- Introduction to Optimize targeting
- URL targeting
- Query Parameter targeting
- Audience targeting
- Behavior targeting
- Geo targeting
- Technology targeting
- First-party cookie targeting
- Data Layer variable targeting
- JavaScript variable targeting
- Custom JavaScript targeting
- Google Analytics Cookie Usage on Websites – Analytics Developers