Count Me Out!

To keep your Google Analytics data pure you should remove all traffic generated by yourself or others that may not be real visitors. For example, if your company has a large call center you should remove the traffic they generate because it will skew your analytics data.

To remove this data we usually use an exclude filter based on IP address, host name or geographic location. While this is effective the results can be a bit ‘broad’. What I mean is you may not want to remove ALL of the traffic from an IP address, host name or geographic location.

Here’s another example. I have a blog (obviously) that I track with Google Analytics and I want to remove all of the traffic I generate. I don’t want to use an exclude filter based on IP address or geographic location because I want to see traffic generated by others in my company and city/state. I only want to exclude the traffic from the computer I am working on.

This technique can also be used if you have a dynamic IP address.

The solution is to create an exclude filter based on another piece of data, more specifically a custom segment. This method isn’t as broad as an exclude filter based on IP, hostname or geographic location. The filter is based on a cookie, which is specific to a computer. Using this method I can eliminate all of the traffic from an individual computer without affecting data created by others.

How to Set it Up

The first step is to set a cookie on your machine that will identify you to Google Analytics. We’re going to use GA’s custom segmentation functionality to do the.

I created a script that will set the GA custom segment cookie on your computer. You can view the source here.

Copy the source and paste it into your favorite editor. Then save the file. For the page to properly display on your website you will need to save it with the correct extension. You should be able to use a .html or .htm extension. It depends on your web server.

Once the file has been saved, upload it to your web server. You may need to use FTP. If you don’t know how to put the file on your web server consult with your web master. You can place the file anywhere on the site.

Then open a browser and type the location of the file in the browser. The page should display as an HTML form. If it displays as text then you probably need to change the file extension.

Enter some text into the text box and click the ‘Create Cookie’ button. The script will set the GA custom segment cookie on your computer and the cookie will have a value of whatever you entered into the text box. Do not use any white spaces or special characters when entering a value for your custom segment. Keep it simple, something like ‘exclude-me’ will work just fine. You should see a confirmation message that the cookie was set correctly.

The next step is to log into your GA account and create an exclude filter based on the value of the custom segment cookie. If you entered ‘exclude_me’ in the form then use ‘exclude_me’ as the value in the filter pattern field. Here are the settings for the exclude filter:

Filter to exclude user defined cookie.

This script works by taking the value you enter in the form and setting it as a custom segment. The great thing about this script is you can place it on your site and then access it from all the computers you work on. Just point a browser to the script, submit the form and all traffic from that machine will be excluded.

Keep in mind that the GA cookies are specific to a domain. So if you want to use this script for multiple websites you need to follow the above process for each domain.

The script is written in JavaScript and has been testing in FireFox 1.5 and IE 6.X.

Share this post:
  • Twitter
  • StumbleUpon
  • Digg
  • del.icio.us
  • Facebook
  • LinkedIn
  • FriendFeed
  • Sphinn
  • Google Bookmarks
  • Reddit
  • email
  • Technorati
  • Yahoo! Buzz

Like this post? How about checking out these related posts:

  1. How Google Analytics Tracks Third-Party Domains
  2. Creating Test Profiles in Google Analytics
  3. Set Your Data Free
  4. Tracking Offline Advertising With Google Analytics

Comments

  1. Tim says:

    Thanks for the great tip. Now, how do I verify that the cookie is installed properly on my machine? Thanks!

  2. Jennie says:

    Hi Justin
    Thanks for this blog – you write clearly and are easy to follow.

    I am wondering if you can help me – I’m still learning all this stuff. I’ve set up google analytics for my company, and I want to exclude internal traffic by cookies (most of our employees work remotely from across Canada & the US).

    I have pasted below the code that I currently have installed, but it doesn’t seem to be working. I know this because I created two profiles in Google Analytics – one that reports all trafic, and one that is supposed to filter out the internal traffic by cookie. However, the numbers are the same, so I know something is wrong.

    Can you take a look at my code and see what might be wrong? I have a feeling it has to do with the last line of code. I have been looking at other people’s comments on this in various blogs, and I see many variations:
    -”utmSetVar” (Some people have it as just “SetVar” – what is the difference?)
    -(‘test_value’) – some people are using (‘exclude_me’) or (‘no_report’) – I’m not sure what the difference is between them and which one I should be using.

    Any help you can offer would be appreciated SO MUCH. My code is below. THANK YOU.

    ——

    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”));

    var pageTracker = _gat._getTracker(“UA-XXXXX-1″);
    pageTracker._initData();
    pageTracker._trackPageview();

  3. Jennie It seems that your problem may be that you have not created a specific page on your website that contains the appropriate code. The concept here is that you need to set a cookie on the computers you want to exclude. To set that cookie you need to create a small script.

    Also, as of right now, I’ve only outlined how to do this for the old urchin.js tracking code. I need to write up a post on how to do this with the new ga.js tracking code.

    Tim Most browsers will let you view your cookies. For example, in FireFox, you can find your cookies in the Preferences section:

    Preference > Privacy > Show Cookies

    To be honest, I’m not sure how to find cookies in IE, I’m a Mac user :)

    Thanks for the questions.

    Justin

  4. Does this work for the new GA code or just for Urchin? I noticed “urchin ” in the code, so I should assume that no one has written anything new yet, right?

    I just upgraded to the new code almost on top of a network refit that went to NAT. Should I go back to the legacy code?

    Thanks in advance for your advice!

    Melanie

  5. If just replacing the urchin file name with ga.js will work; I’m willing to do that on my own.

    Melanie

  6. Melanie,

    The example in this post only works for urchin.js. I have not had a chance to create a version for ga.js yet.

    Unfortunately you can’t just replace urchin.js with ga.js. There are a number of function calls that need to be replaced with method calls. I’ll try to get an update out as soon as possible.

    Justin

  7. Micki says:

    Hi Justin,
    This is great. We installed this cookie in July and it has been working perfectly until recently. I created a funnel for a shopping cart goal and am noticing that I am being counted when I am on our website going through the funnel steps (i am able to look in GA at the path and the path is identical to the one I took). I don’t think I cleared cookies in the past so I pulled up the script in a browser and resubmitted the cookie button. I’m hoping this will clear the problem. My understanding is the count me out works for the IP address so in theory I should be able to go to any page of our website and not be counted. Is this correct? Thanks again for a fantastic tool.
    -Micki

  8. Micki,

    The exclusion is actually based on a cookie, not on your IP address. That’s why this approach can help small businesses or any organization that has a changing IP address.

    I would also double check and insure that your filter is correct and is excluding the “user defined” value that you set in your cookie.

    Glad you like this technique and thanks for the question.

    Justin

  9. I also realized that you can automate the cookie installation method described by Mark M by coding your “cookie page” with an instant redirect script and meta refresh tag (to the real homepage) and assigning it as the homepage in the browser; so the cookie will be automatically replaced on public computers (which are usually set to delete cookies when the browser closes). I haven’t implemented this yet; but it sounds like it should work?
    -Melanie

  10. Hi Melanie,

    That should also work. This script is in dire need of an update! I’ve been trying to get it done forever, but there are just so many things to blog about.

    Justin

  11. Agnes says:

    Hi, this is very great
    I d just like to check: does it work with the new version og GA code?
    Thanks
    Agnes

  12. Agnes,

    Unfortunately no, this only works with the old version f the tracking code.

    I’ll try to get something done soon.

    Justin

  13. Justin,

    Very good script indeed. I always use IP exclusion, but it is tough when you are always changing location… and not dare to visit your own website lest the analytics be biased :-)

    Please comment here when you have a version for the new tracking code. I will pingback it ;-)

    Cheers,
    M.

  14. Jen says:

    Just a tip: to make it easily understandable for non-tech staff I changed the Title from “count me out” to :
    1. Please type in”remove-me”
    2. Go to website

    Then a simple email asking them to visit xyz link and follow the on-screen instructions makes it understandable for everyone.

    I also added a (little) joke to the alert message on http://www.concept-academy.co.il/no-statcount.html
    Feel free to have a look.

    Thanks Justin for this gem.

  15. Heros says:

    Great Mike !!

    I got to the same solution with PHP. I cache the dinamic dns (more than one, home and workplace) in the session, then I exclude the GAnalitycs code.

Trackbacks

  1. [...] today i found a web blog with a solution of this problem , thanx to Justin Cutroni for this >> Count Me Out! [...]

  2. [...] I found this online yesterday as a method to avoid skewing Analytics with all your visits to your site. I won’t be able to begin seeing if I don’t show up until tomorrow. (I’ve noticed it doesn’t affect data already in Google Analytics.) http://www.epikone.com/blog/2006/07/11/count-me-out/ That was one thing I had to learn on my own. Also, you’re going to have to do this for each browser. So if you’re testing in both IE & FireFox, then you’ll have to set the cookie on each. [...]

  3. [...] Other great examples of custom filters: Create a filter to learn what words people actually type in to Google before they click on your AdWord, instead of just learning which AdWord gets credit. (I use this one all the time. The only hack I like better is this one.) Force all your reports to give you pages by title instead of URL. [...]

  4. [...] Other great examples of custom filters: Create a filter to learn what words people actually type in to Google before they click on your AdWord, instead of just learning which AdWord gets credit. (I use this one all the time. The only hack I like better is this one.) Force all your reports to give you pages by title instead of URL. [...]

  5. [...] So on the off chance that I haven’t already given enough publicity to this workaround: my favorite answer for a small company is to use this workaround, called “Count me Out!. [...]

  6. [...] Another good way to exclude internal traffic, especially if you don’t have a static IP address, is to use a little hack called Count Me Out. This hack uses the GA custom segment cookie to identify users. [...]

  7. [...] Φαντάζομαι ότι πολλοί από εμάς χρησιμοποιούμε το φοβερό Google Analytics (GA) για να κρατάμε στατιστικά επισκεψιμότητας και κυκλοφορίας της σελίδας μας. Θέλουμε, όμως, να αποκλείουμε από τις μετρήσεις τις επισκέψεις που κάνουμε από τους δικούς μας υπολογιστές. Επειδή οι περισσότεροι διαθέτουμε δυναμικές IP διευθύνσεις από τους ISP δεν είναι δυνατό να ορίσουμε στα φίλτρα του GA ένα εύρος διευθύνσεων που θα θέλαμε να αποκλείσει. Μια πολύ καλή και λειτουργική λύση βρήκα εδώ. Είναι πολύ εύκολη στην υλοποίηση, απλά ακολουθούμε τις οδηγίες και “τρέχουμε” το sciptάκι από όποιον υπολογιστή δεν επιθυμούμε να καταγράφονται οι επισκέψεις. Το δοκίμασα και δουλεύει… Tags: browser, google, stats, διαδίκτυο [...]

  8. [...] Analytics Talk » Blog Archive » Count Me Out! how to exclude your own visit from google analytics stats, a practical howto. interesting technique involving the use of a cookie, which is signaling who you are to the tracking system. (tags: analytics filter google howto electronic_presence) [...]

  9. [...] Google Analytics Hack » Count Me Out! – keep your Google Analytics data pure you should remove all traffic generated by yourself or others that may not be real visitors. For example, if your company has a large call center you should remove the traffic they generate [...]

  10. [...] It’s quiet annoying that every time you visit your own website, google analytics is picking you up as a visitor. After some googling. I found a solution, the trick is to set a cookie on your own computer and setup a filter in analytics ignoring everybody who has this cookie. [...]

  11. [...] I would like to thank, Justin Cutroni, as his blog was the first clear explanation I encountered. [...]

  12. [...] I would like to thank, Justin Cutroni , as his blog was the first clear explanation I encountered. [...]

  13. [...] I think I found a way to exclude myself from the numbers by using a cookie and filter. I’ll have to give the numbers a look over in a few days to see if this works. [...]

  14. [...] IP addresses or addresses – Google Analytics explains how. And (of course) Justin Cutroni also has some great tips for how you can exclude a single computer – especially handy if you have a dynamic IP [...]

  15. [...] #3: Thanks to Phil LeClair for point me to this article, “Count Me Out!” on Analytics Talk, we now have an answer to our question about excluding dynamic IP [...]

  16. [...] Google Analytics Hack » Count Me Out! – keep your Google Analytics data pure you should remove all traffic generated by yourself or others that may not be real visitors. For example, if your company has a large call center you should remove the traffic they generate [...]

  17. [...] Analytics Talk » Blog Archive » Count Me Out! – To keep your Google Analytics data pure you should remove all traffic generated by yourself or others that may not be real visitors. For example, if your company has a large call center you should remove the traffic they generate because it will skew your analytics data.To remove this data we usually use an exclude filter based on IP address, host name or geographic location. While this is effective the results can be a bit ‘broad’. What I mean is you may not want to remove ALL of the traffic from an IP address, host name or geographic location. [...]

  18. [...] There are a variety of ways to filter yourself out of your Google Analytics reporting. We prefer the IP based filter but you can also try the cookie method. [...]

  19. [...] If you’re using Google Analytics, you can simply add a filter to exclude your IP address, but there’s a better way described in the article Count Me Out! [...]

Speak Your Mind

*