How to exclude your own traffic in Google Analytics

So you’ve got Google Analytics set up and you’re tracking your web site statistics. But every time you visit your web site (to do testing, training, etc.) your reports are skewed because they include traffic from your own computer. One way to fix this is to set a cookie on your computer with some predetermined value, and then use a filter in Google Analytics to exclude traffic from any computer that has that cookie set.

Step 1: Create a page to set a cookie

Create a new html page on your website that contains the following code:

<body onLoad=”javascript:_gaq.push([‘_setVar’, ‘test_value’]);”>
<p>Your traffic from this browser will now be excluded from Google Analytics</p>

Make sure you insert your Google tracking code between the <head></head> tags. Save the file as “exclude_traffic.htm” in the root of your website.

Step 2: Visit the page with your browser

Open up your browser and navigate to the page you just created. For example:

You should see a page that says “Your traffic from this browser will now be excluded from Google Analytics”. If you use multiple browsers to test your web site, you will need to visit the page from every browser you use.

Step 3: Create a filter

Login to your Google Analytics account and create a new filter (click “Admin” then go to the Filters tab). Create a custom filter with the following attributes:

Filter Type: Custom filter – Exclude
Filter Field: User Defined
Filter Pattern: test_value

Finally, make sure you apply the filter to all your profiles.




Add a Comment

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