Friday 18 July 2008

Setting an Exclusion Cookie for Google Analytics with a Bookmarklet

I have been doing a lot of work on my reading software website recently. This has played havoc with my Google Analytics reports.

So I set about looking for a way to block my own hits from the results. Having done a good search for up to date techniques, it seems that a cookie and a filter in analytics are still the current standard.

I came across loads of articles explaining all this, but none were really clear, so I thought I might cover the subject again. Partly for those who follow after me, and partly so I never need to research this again.

So for posterity here’s how to go about it.

Creating the Exclude Filter

I have written a seperate post on how to add an Exclusion Filter to Analytics in 10 easy steps with loads of screenshots.

How to add an Exclusion Filter to Analytics in 10 steps



Creating the Cookie

Rather than go down the route of having to install something onto my website, I decided to create a BookMarkLet to generate the exclusion cookie.

This means I can use it for any site, it is quick and simple to use and most importantly there is no need to install anything on the website itself.

Another benefit is that I can get anyone working on or reviewing my site to use it as well, without too much trouble. All in all, a win-win solution to the problem.

Get the BookMarkLet: Drag this link to your browser bar (add it to your bookmarks)
GA IgnoreMyHits

Then to put the cookie in place:

  • Go to the site you want to stop recording hits on
  • Click on the bookmarklet(above) you have stored
    • let it add the exclusion cookie to your browser.

First : choose you exclusion cookie name...



 Then: Make sure it all worked. It will recognise your analytics install and tell you which one it detected.





If, like me, you use differant browsers for testing, make sure you do this with all of your browser,s rather than just your main one. This will ensure that your analytics results are totally accurate.

The only thing you must ensure is that you use the same name for both the cookie and the exclusion filter in analytics.



So there you go a nice quick simple solution for clearing up your Analytics results.

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



A shameless plug..

Bring the benefits of over 15 years experience in internet technologies, from programming through to usability & design, persuasive copy-writing and site speed optimizations.
Check out my consulting company, Technical Magic.

1 comment:

  1. Great job! This works with google pages. However, don't work with google sites. It seems it's really hard to make cookie in google sites analytics. In google sites, you can not use the script method either. Its analytics is integrated in some other way ...

    ReplyDelete