Block Local Google Analytics Page Views

When working on a website, either for web development or SEO work it involves visiting the site you are working on and this causes incorrect data in Google Analytics. So how can we rectify this situation?

Using Filters

The first and most common way of solving this issue is to use the Filters feature of Google Analytics.

  1. Go to www.whatismyip.org and note down your ip address
  2. Go to the profile that you wish to filter, click Add Filter and then follow the image below, substituting the ip for the one you have noted down.
  3. That’s it! You’re done. You can add as many of these filters as you require for the ip’s that you use regularly
Office IP Google Filter Setup

Office IP Google Filter Setup

Using hosts file

The solution above works fine if you have just one or maybe two places that you use to visit the clients site, but what if you travel regularly? You will have a constantly changing ip address based on the connection you are using. The solution to this? Use your hosts file to redirect all Google Analytics requests to an internal ip.

On Windows (32 Bit) the hosts file can be found in:

C:\Windows\System32\drivers\etc\hosts

Open up that file in Notepad (or Notepad++ preferably) and add the following lines:

# BLOCK GOOGLE ANALYTICS
127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com

This will redirect ANY Google Analytics requests to 127.0.0.1 which is your computer, thus stopping any unwanted traffic in Analytics.

Note: This will block ALL Analytics requests so other sites will not register your traffic either, ahh well :)

Hat-tip to Gaz @ SEO Rocks for the last tip.

One thought on “Block Local Google Analytics Page Views

  1. Pingback: Block Local Google Analytics Page Views | Dan Taylor – Just Search | SFWEBDESIGN.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>