How to Exclude Internal Traffic from Analytics Reports

Google Analytics

This guide is intended for webmasters who use Google Analytics to track visits to their websites. The tutorial below will demonstrate how to set up filters using Google Analytics and how to upload the file that will generate a cookie that will block your site visits from being recorded. Setting up these filters will help you get a better picture of the traffic coming to your site and keep the internal traffic (your own traffic)from skewing the data. If you have any comments/suggestions please post them below.

Note: I have included the .html file you would use on your site to block the traffic. The file is listed at the end of the article for you to download.

Google Analytics

1. Go to the Google Analytics website and log on to the website.

Google Analytics

2. Once you are logged on, click on the Analytics Settings link right below the Google Analytics logo.

Google Analytics

3. To add or modify filters, click on the Filter Manager link.

Google Analytics


4. The Filter Manager lists all existing filters for your site, since we are adding a new filter to the site, click on the Add Filter link.

Google Analytics

5. The New Filter window will open, since we’re going to be doing several things on this page, I have listed them below;

A. Enter a name for the filter in the Filter Name: box

B. Select Custom Filter from the Filter Type drop-down.

C. Select the Exclude filter

D. Select User Defined from the Filter Field drop-down

E: Type in the name used for the pattern in the Filter Pattern box, this will be the name used in the HTML file we will create in the last step. I used internal for the pattern, it’s easy to remember and identify.

F. Select a website profile from the Available Website Profiles listed, chose the site(s) that you wish to add this filter to and click Add

G. Once you are done click on the Save Changes button.

Google Analytics

6. Your new filter will be listed in the filter manager. If you need to edit or delete the filter you can do it from here.

Adding the HTML Code to Your Site

Google Analytics

1. Now that the filter is configured in Google Analytics you need to upload the HMTL file containing the code that will create the blocking cookie for your browser. Using your favorite HTML editor or Notepad type the following code: <body onLoad=”javascript page Tracker._setVar(‘internal’);”> When done, Save the file.

Note: ‘internal’ is the user defined word you specify, in this case I chose internal.

Update 7/13/2010If code is not working, it may be due to changes in the asynchronous google analytics snippet, if this is the case, use the following code instead.

body onLoad=”javascript: _gaq.push([‘_setVar’,’internal’]);”>

Thanks to Rodrigo for the update in the comments section below.

2. Now upload the file to your server, make sure to note where the file is located so that you can reference it in your browser and block your internal traffic.

Note: I have included the HTML file with the code so that all you have to do is customize it and upload it. See below.

3. Once the file has been uploaded, open your browser and type in the address where the file is located, http://www.mywebsite.com/exclude_traffic.html (I used mywebsite.com/exclude_traffic as an example, use your site and the file name you specified)

Your Google Analytics report should now exclude the traffic you generate on your site.