Tutorial :How to filter myself out of Google Analytics with a dynamic IP address?


Does anyone know how to setup Google Analytics to filter yourself out if you're visiting the site from a dynamic IP address? I don't want to include myself in my stats from home use where I have a dynamic IP address via Verizon FiOS.


Google currently has a browser add-on that will block any visits of yours from showing up in any Analytics. http://tools.google.com/dlpage/gaoptout

Pluses and minuses of this opt-out versus filters are discussed in this blog post.


There are a couple ways of doing this. If you know the range of IP addresses you're accessing your site from (and don't mind filtering them all out) you can set up an "Exclude" filter for that range of IP addresses. If that's too restrictive, you can set a cookie using the Google Analytics code and filter on that. Both techniques are documented at Google's help system.

Alternatively, if you're dynamically producing the pages on the server, you could simply not write the Google Analytics code into the pages in the first place, based on the currently logged in user. On my site, I'm choosing to write the code or not based on a few things, such as whether the website is running in debug mode or if an administrator is logged on.


You can do this by creating a special page on your site that sets a Google Analytics segmentation cookie, using code something like:

<body onLoad="javascript:__utmSetVar('exclude_from_report')">  

Then create a custom filter in Analytics to exclude visitors that match the 'exclude_from_report' segment pattern.


Consider using the NoScript plugin for Firefox. Just mark google-analytics.com as an untrusted site and you should be all set. A nice side-benefit: better security in your browser.


Just block the domain where google analytics lives via your system's hosts file: www.google-analytics.com

This is less disruptive than the NoScript plugin mentioned by jdigital, but still makes you effectively invisible to google analytics.


Setting a cookie to prevent the analytics code from being sent to the browser is by far the best option.


If you're a developer and concerned that you're going to get a bazillion hits while you're developing the site you can add the following line in your analytics tracking code :


Assuming you're hitting a url not ending in .yourwebsitename.com during testing then the tracking code will see your URL is 'localhost' and not 'yourwebsitename.com' and not send any tracking.


You can always setup a proxy to tunnel all of your traffic through. Then simply exclude the proxy's IP from the results.


can't find a way to reply to answers, I second to the hosts file trick: www.google-analytics.com

as it works in all browsers at the same time, as designers often try site in all browsers.


I recommend to use a (localhost) redirect in the HOST file to block all/any type of abusive sites or domain/trackers/analytic and such. For a large list take a look at the WinHelp website. I have and still use it for all my PC's. You also need to look over the list which domains you do want and remark the lines with a # tag in the list.

All instructions are on the site for different operating systems.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »