How to exclude a dynamic IP address in Google Analytics
Are you using Google Analytics and worried about bloating your traffic results with internal visits? Have your ever looked at your Analytics stats and thought “wow, I havn’t even been marketing my site and I already have visitors!”? Well you may be artificially bloating your statistics with your own click-throughs. Here is a quick guide on how to block a dynamic IP address in Google Analytics.
Blocking your internal visits will give better Analytics results
First, you need to create a new blank page for your site. I tend to just call this page “cookie.html”. Next, in between the body tags insert the following code:
<body onLoad=”javascript:pageTracker._setVar(‘test_value’);”>
This alone, however will not do anything. You also need to make sure that you have your Google Analytics code on the page so now copy and paste that right below the code you just dumped in. (You can find your Google Analytics code by going to your Analytics dashboard and then clicking “Edit” next to your site. Next, where is says tracking in the top right click “check status” and you will find the code.)
Once you get the code on the page, upload it to your server. Now, we are going to go back into analytics and add a filter to your account that will tell Analytics to look for the cookie on each computer that has visited cookie.html.
On the dashboard in Analytics click on “Filter Manager” at the bottom of the page and then in the top right of the next page click “Add Filter”. Give your filter a name like “IP Exclude” and then do the follow:
- Click the “Custom Filter” Button
- Ensure that “Filter Type” says “Exclude”
- Filter Field needs to be changed to “User Defined”
- Type “Test_Value” where it says “Filter Pattern”
- Ensure case sensitive says “No”
- Click on the website profile(s) to add the filter to and then click “add”
- Make sure you save changes.
- That’s it!
Finally, go to your domain/cookie.html (or whatever your named the file). This will install the cookie on your local machine and tell Analytics not to count your visits to the site. You will need to visit this page from every machine you use for it to work. Where’s the “Easy Button” when you need it? You now have a filter setup on your analytics account that will prevent you from inflating your statistic and allow you to get a better read on your site’s traffic.
Sources:
http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55481
http://www.google.com/support/googleanalytics/bin/answer.py?answer=55494