Excluding visitors with Google Exclusion Cookie
It’s easy to exclude certain visitors from you Google Analytics results by using Filters. Team members who are using a static IP, for example, can be excluded by this method. But what about other visitors using a dynamic IP, such as team members working from home or remotely from another office?
The good news is, there’s now an easy way to exclude these visitors using the new Google Exclusion Cookie, and what’s more it takes just two steps to set up.
The Google Exclusion Cookie method has been created specifically to target visitors using dynamic IP addresses. Based on a cookie file and a dedicated exclusion filter, this is how it works:
Step 1
First, set up your exclusion cookie. Create a new, blank html page on your site with the following address:
www.mysite.com/ga-exclude.html
The code should be as follows. Please update your the Google script calls with the Google script calls for you account:
<html>
<head>
<title>Analytics Exclusion</title>
<meta content=”noindex, nofollow” />
</head>
<body onLoad=”javascript:pageTracker._setVar(’exclude_visitor’);”>
<div>
<h1>Google Analytics Exclusion Cookie is now set</h1>
<p>Your visits to this site will no longer affect the analytics statistics.</p>
<p>Please note: If you use a different browser to visit this site you will need to visit this page again.</p>
</div>
<script>
var gaJsHost = ((”https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
</body>
</html>
The _setVar() method in the above code is stored in the _utmv cookie, a persistent cookie with an expiration date that can be set for up to two years, and is only set up if the _setVar() method is called. This happens when a visitor visits the page; when the _utmv cookie is created, all information about the visit and visitor are stored in this cookie file.
After setting up the cookie you should insert standard Google Analytics tracking code on the page and save this page on your server.
Step 2
Next you have to set up an Exclusion Filter in Google Analytics. Log in to your Google Analytics Account, choose the profile you want to edit and create a new filter. Give it a name, set Filter Type to Custom Filter and choose Exclude. From the drop-down menu next to the Filter field, select User Defined and name your Filter Pattern exclude_visitor. Leave Case Sensitive as No and save your filter.
Note that exclude_visitor was used in _setVar() method as the method argument and it needs to be the same in the Filter Pattern Value. If this value is different, your filter will be unable to read your cookie.
When your exclusion cookie and exclusion filter have been created, you need to point the visitor you want to excluded to the cookie page, www.mysite.com/ga-exclude.html. Once the cookie is on your chosen visitor’s browser, it will remain there for 24 months, during which time your chosen visitor’s visits will not be included in your Google Analytics data.


