Monday 20 April 2009

How to block your own PC from skewing your site’s Google Analytics statistics

So, your web site is live and you're making small tweaks here and there and connecting to your site to test the changes - but you don't want your own PC to skew your site’s Google Analytics statistics… ie: you want to see how many "real" hits your site is attracting.
Here are 2 tricks that should assist you:

Method 1 relies on installing and configuring firewall software on your PC;
Method 2 involves editing the Windows hosts file.

Method 1: A crude way of blocking access to the Google Analytics site – so that you don't clock up hits would be to configure a firewall on your PC to prevent connections to the whole
www.google-analytics.com domain.

I have tried it with the free
Comodo Internet Security (which is a free bundle of a firewall and virus protection) and configured the firewall part to have a “blocked network zone” -> and added the “host name”: www.google-analytics.com
{and google-analytics.com}


This will then block ALL traffic from your PC to the www.google-analytics.com site. {That’s why I said that it’s “crude”}

The page will load, but appear to wait for a connection to complete – that’s the browser trying to connect to www.google-analytics.com

Download from here:
http://personalfirewall.comodo.com/download_firewall.html

Note: it’s a bit of a pain to start with because it’s got to learn which apps are safe - so it pops up and asks you if an app or connection is safe. To start with, I put it in “learning mode”.


Method 2: You could add google-analytics.com and www.google-analytics.com both as 127.0.0.1 to the windows host file as follows:
Edit the 'hosts' file: edit %SystemRoot%\system32\drivers\etc\hosts
and add the following 2 lines:
127.0.0.1 google-analytics.com
127.0.0.1 www.google-analytics.com

Save the file and voila - all traffic destined for google-analytics will get routed to your local PC!

I prefer method 2 (although installing a firewall and learning how to use it is not a waste of time!)

Let me know which method works best for you?

Update:
Here's Method 3 which I found on the Google Analytics help page - so I guess it's the preferred option ;) but method 2 above is simpler.
From here: https://www.google.com/support/googleanalytics/bin/answer.py?answer=55481&ctx=sibling

In summary,
if you have a fixed IP address (or range) then use Google Analytic's "filter" that will "filter all traffic from an IP address".
if you have a dynamic IP address (ie: using an ADSL line) then create a filter that will exclude traffic by Cookie content.

No comments:

Post a Comment

Live Traffic Feed

 

Be notified of
page updates
it's private
powered by
ChangeDetection

Copyright © 2008 HandyTechTipper. All articles are released under the Creative Commons Attribution 2.5 South Africa license, unless where otherwise stated.