Filter Yourself From Google Analytics
analytics, google
If you are like me, you are probably one of the most frequent visitors to your own site. And if you are using Google Analytics this can present a number of problems when it comes to accurate reporting. This tutorial explains the best and easiest way to filter your own computer from Analytics reporting.
This is a two pronged approach that uses a combination of scripting to place a cookie on your computer and a custom filter in Google Analytics.
STEP 1 – Cookie
The first thing that you need to do is create an HTML file that places the required cookie information on your computer. To do this you will need to create a blank HTML file. If you are not familiar with HTML, simply open a new text file in Windows (not a Word Pad file, rather a Note Pad file). Now save this file as filterGA.html and keep it open for editing.
You will need to place the following into the file and save it when finished:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Filter GA</title>
</head>
<body onLoad=”javascript:pageTracker._setVar(‘test_value’);”>
<script type=”text/javascript”>
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>
<script type=”text/javascript”>
var pageTracker = _gat._getTracker(“UA-927027-2″);
pageTracker._trackPageview();
</script>
</body>
</html>
Now upload this file (filterGA.html) to your web server. Place it anywhere you want as long as the file can be accessed from a web browser.
Next, visit the page that you just uploaded using your browser. You should see a blank white page. I recommend bookmarking this page so that you can re-visit the page anytime you are working on a new computer or after you clear your cookies and cache from your machine.
STEP 2 – Filter
Now, you will need to set up a filter in Google Analytics. Log into your Analytics account and navigate to the Filter Manager, then click the link to add a new filter.
In the first field add a name for the filter for identification.
In the second field, from the drop-down select “Custom Filter.” This will open additional fields. Select the radio button next to the top choice, “Exclude.”
From the drop-down menu called “Filter Field” select the option “User Defined.”
In the “Filter Pattern” field, type “test_value” and choose “no” for case sensitive.
Select the websites that you wish to apply the filter too (most likely all of the sites being tracked in your Analytics account), and save your changes.
Finished! You are now being filtered out of your analytics reporting from this moment onward. Just remember to re-visit the filterGA.html page from each computer that you use to view your traffic stats. Also be sure to revisit the cookie page if you delete cookies or clear your old browsing data to ensure that the cookie remains in place.
There are many ways to filter yourself out of Google Analytics, but this method is my preferred option. In this way I have more control over when and from where I am filtered.







It seems like I had to put a cookie “test_value” on EVERY DOMAIN I’ve in analytics ’cause it doesn’t work for me now, as I’ve the cookie only on one domain. My traffic is excluded only there, on the others, no.
Comment by Matt — February 15, 2009 @ 10:47 am
Thanks Heaps..
I was thinking my blog was getting a lot of hits. Now i can get accurate website stats..
Thanks again
Cory Thompson’s last blog post… How to install DOS into VirtualBox
Comment by Cory Thompson — March 7, 2009 @ 2:52 am
We have to change the tracker ID right? (UA-XXXXXX-X)
Comment by ZenGlen — March 12, 2009 @ 7:40 pm
hi, i want use GA excluding with test_value cookie. I thing, every is right, but im not sure that excluding working.
I try to answering by including test_values in GA. But no visits in this profile.
In my browser (opera in Mandriva 2009) exist cookie __utmv:181981858.test_value
Please help me, where is bug
Comment by tcladin — September 4, 2009 @ 11:45 pm
ok, today found visits in GA “include” profile presented.
1) I used html exact code of start of this page (with my acount number). 2) I used only one rule(filter) in some GA profile, http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55550.
3) I made bookmark page with JS “value_test” in my browser.
Comment by tcladin — September 6, 2009 @ 12:01 am
yes i am implementing it to my site right now… great article…
Comment by freelance writer — January 5, 2010 @ 9:48 pm
Thanks Zach for instructions, as google help page doesn’t help so much.
Comment by Vi — April 15, 2010 @ 4:57 pm