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.
10 Answers
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.

- 171
- 1
- 2
-
We usually do most of the visits to our own site while at work, so this is the desired solution – I.G. Pascual Jul 21 '16 at 16:29
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.

- 85,731
- 25
- 98
- 139
-
The cookie method seems to work well. Can just direct page content editors to view that page to filter them out. – pelms May 28 '09 at 14:27
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.

- 41,170
- 10
- 86
- 110
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.

- 11,926
- 4
- 34
- 51
-
I didn't even think of that (I'm running NoScript), I'll give that a shot, thanks! – Mar 07 '09 at 04:29
-
Setting a cookie to prevent the analytics code from being sent to the browser is by far the best option.

- 2,166
- 1
- 24
- 37

- 111
- 1
Just block the domain where google analytics lives via your system's hosts file:
127.0.0.1 www.google-analytics.com
This is less disruptive than the NoScript plugin mentioned by jdigital, but still makes you effectively invisible to google analytics.

- 10,550
- 3
- 39
- 36
-
provided it doesn't affect any reporting capabilities this seems like the easiest way, but could quickly become cumbersome if you have many developers – Simon_Weaver Mar 26 '09 at 02:57
-
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 :
pageTracker._setDomainName(".yourwebsitename.com");
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.

- 140,023
- 84
- 646
- 689
I recommend to use a 127.0.0.1 (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.

- 2,836
- 33
- 28
can't find a way to reply to answers, I second to the hosts file trick: 127.0.0.1 www.google-analytics.com
as it works in all browsers at the same time, as designers often try site in all browsers.

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

- 1,020
- 4
- 15
- 26