Saturday, June 19, 2010

How to stop Google Analytics from tracking your own visits

If you use Google Analytics to track visitors to your websites, it’s important to have Analytics filter out and exclude your own visits to your sites in order to get a true picture of your sites’ visitor count and demographic. You might be visiting a dozen pages on your site everyday and all these visits and page views can grossly inflate the visitor data of your sites. Unlike tracking services like Statcounter and Sitemeter, Google Analytics does not have an easy way of excluding your visits, particularly if you are on a dynamic IP.

If your net connection has a static IP, you can filter out that IP from being tracked. But if you are on a dynamic IP, like most of us are, you will need a different solution.

The solution is this: we will 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

If you use the new Ga.js tracker

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.

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.

No comments:

Post a Comment