Excluding internal traffic from Google Analytics reports by creating a tracking cookie using the new _setCustomVar() isn’t as hard as you think.
Sure, there are simpler methods for filtering out internal visits available right from your Google Analytics control panel but for a variety of reasons, sometimes those just don’t work. If you need to specifically target and exclude visits from multiple people, using multiple devices and multiple browsers from multiple IP’s, do not fear the _setCustomVar() method.
Follow these few simple steps and you’ll be ticking along in no time:
- Create an orphaned page on your site and name it accordingly. If your site is http://www.myredwine.com, create: http://www.myredwine.com/exclude.html
- Make the html content of the page say this, (taking care to insert your own Universal Analytics number where indicated):
Here’s the html which you can copy and paste, (only copy what’s in blue and remember to insert your own Universal Analytics number):
<title>Remove My Internal Traffic from Google Analytics</title>
var _gaq = _gaq || ;
_gaq.push([‘_setCustomVar’, 1, ’employee’, ‘Yes’, 1]);
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’); s.parentNode.insertBefore(ga, s);
<h2>Remove My Internal Traffic from Google Analytics</h2>
Visit this page on every computer, tablet, and smartphone, and for all browsers you use on those devices.<br>
- Create an advanced segment in Google Analytics by following the steps below. Fill out the boxes exactly as I have filled them out.
Step #1 – Go to the Reporting/Audience Overview section and look for the +Add Segment box.
Step #2 – Click on +New Segment.
Step #3 – Select Conditions under the Advanced section and Custom Variables from the Ad Content dropdown.
Step #4 – Fill out the dropdowns exactly as I have filled them out and then click +Filter and fill the second set out as well. Click Save.
- Share the link and ask everyone you want to exclude from reporting to visit the new page, on every device they own, with every browser they use. Take care to re-visit after deleting cookies from a browser.
That’s the long and short of it.
Now, if you don’t know how to add an html page to your site or blog make sure to sign-up for our newsletter!
There just might be an article coming down the pipes that can help with that too…