How to use Cookie targeting?
There are many ways how you could use Cookie targeting, but the main requirement to use this feature - your website needs to set cookies for visitors, when specific conditions are met. So that later you could target these visitors based on cookie names and values. One example below:
Target visitors based on traffic source
1. Adding UTM parameters to landing page URLs
If you are running advertisement campaigns in different websites (Forbes, Business Insider, etc.) then the best practice is to add UTM parameters for your landing page URL, so that later you can analyze results in Google Analytics based on traffic source.
If your website domain is myweb.com, then when someone clicks on your ads for example in Forbes.com, then he should be redirected to your landing page with UTM parameters similar to these:
http://www.myweb.com/?utm_source=forbes.com&utm_medium=display&utm_campaign=summer-promo
In this example you can see that 3 parameters are added:
- utm_source
- utm_medium
- utm_campaign
But there could also be other or different parameters, depending on what information you want to later use for analyzing visitors and targeting them.
2. Setting cookies
If you would like to target visitors based on traffic source, then you would need to ask your IT team to set cookies based on these UTM parameters. For example, if your website uses PHP technology, then programmers would need to use a code that would be similar to this:
<?php
if(isset($_GET['utm_source'])) {
//set traffic source cookie for 24h
setcookie("traffic_source", $_GET['utm_source'], time()+3600*24, "/", "myweb.com");
?>
This code is checking, if utm_source parameter is used in the landing page URL, and if so - then the code sets a cookie in visitors browser with following parameters:
- Cookie name: traffic_source
- Cookie value: the value of utm_source parameter in the landing page URL
- Cookie expire time: 24 hours
So if we would look again at the landing page URL used in example above:
http://www.myweb.com/?utm_source=forbes.com&utm_medium=display&utm_campaign=summer-promo
Then this PHP code would set cookie with these values:
- Cookie name: traffic_source
- Cookie value: forbes.com
- Cookie expire time: 24 hours (from the time cookie was set)
3. Targeting visitors based on cookies
Finally, if you are using UTM parameters when sending traffic to your website, and also set cookies, so you can later identify specific groups of visitors, then you can also target them by cookie values.
When you add new Overlay, then in "Target visitors" step, find the "Cookie Targeting" section and select "Use cookie Targeting":
Here you can enter the Cookie name, select condition that needs to be matched (for example - cookie value needs to be contain a specific text, or must start with some text, or if it is a number - must be higher or lower than value you specifiy).
In our example - let's say, that we would like to target visitors who came from Forbes.com advertisement campaign, then we would set following targeting settings:
And that is it. Save campaign - and it will be shown only to those visitors, who came from Forbes.com