Monday, November 19, 2007

How to exclude your own visits from Google Analytics and ClustrMaps

After a 5 minute Google (re)search I found a few ways to exclude my own visits to my sites/blog from the Google Analytics and ClustrMaps reports.

Google recommends two ways of doing this:

  • Creating a filter that excludes your IP address from the reports
  • Installing a cookie in your browser and creating a filter that excludes your visits from the reports

I don't find the first option very useful because I don't use static IP addresses.

As for the other option, I really didn't try that. Google doesn't explain very well how to do it and I didn't have the patience to explore that option.

Another downside of both of these options is that they require that you edit your html. OK, that's not really a problem but when you're managing a blog, you don't want to mess with your HTML too much.

I found an easier approach in here:

Use AdBlock Plus to block communication with Google Analytics and ClustrMaps.

These are the addresses I had to block:

  • http://www.google-analytics.com/urchin.js
  • http://www3.clustrmaps.com/counter/index2.php?url=http://(enter your address here)

Don't forget to disable the Collapse blocked elements option in AdBlock. If you don't disable that option, you won't be able to see the link to you ClustrMap (Adblock simply doesn't show anything).

[Update]

Ok, there's a problem with the approach I described for Google Analytics: It will block the analytics scripts of other sites you open (including your friends' blogs).

To fix this you have to... well, change the HTML of your site :-D

In your HTML find the following tag:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">

and replace with:

<script src="http://www.google-analytics.com/urchin.js#url=http://(replace with your site url)" type="text/javascript">

I added the #url=http:(replace with your site url) which in fact doesn't do anything when getting the script from the server but allows us to setup AdBlock to block this URL.

Next, you have to setup AdBlock to block only http://www.google-analytics.com/urchin.js#url=http://(replace with your site url) instead of the late http://www.google-analytics.com/urchin.js.

No comments: