Home » Traffic

How to exclude your own traffic from Google Analytics

14 March 2010 1,274 views No Comment

If you are using (and you should!) a service to track visitors to your website, it is very important to exclude your own visits from the statistics, in order to keep the relevant data.  Google Analytics offers the option to stop tracking visits from a distinct IP. If your connection has static IP, this option will work very well. But if you have a dinamic IP, you need a different approach.

The idea is to set a cookie on our browser and then use Analytics’ filter to ignore visits from all machines that has this cookie set. In order to create this cookie, create a page on your website with the following code on it.

If you use the old urchin tracker

<body onLoad=”javascript:__utmSetVar(’ignore_cookie_name’)”>

If you use the new Ga.js tracker

<body onLoad=”javascript:pageTracker._setVar(’ignore_cookie_name’)”>

Replace ignore_cookie_name with any name of your choice. The name should be unique because if any other visitor has a cookie of the same name, his visits will be ignored too. Throw in some random numbers to nullify any chance of somebody coincidentally naming their cookie the same.

The next step is the create a filter on Google Analytics. To do this, follow these steps:

1. Click ‘Analytics Settings’ and then click on ‘Filter Manager’ at the bottom of the page.

2. Click ‘Add Filter

3. On the Create New Filter page, create a new filter with the following settings:

Filter Type: Custom filter > Exclude

Filter Field: User Defined

Filter Pattern: ignore_cookie_name (replace with actual name)

Case Sensitive: No

4. Under the ‘Apply Filter to Website Profiles’ section, select the website you want to apply this filter to.

analytics cookie

The final step is to set this cookie on your browser. For this, simply visit the page having the JavaScript code. Make sure no visitors to your site has access to this page, otherwise the cookie will be set on their machines too.

To verify this is working correctly, place Analytics tracking code on this page and visit it a couple of times each day. Then try to find data about this page on Analytics report. If you can’t find any, it means that the ignore cookie is working.

[source]

Related Posts

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

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

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.