views:

931

answers:

6

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.

+4  A: 

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.

Chris B.
Hmm, the cookie sounds promising, I'll check it out, thanks!
The cookie method seems to work well. Can just direct page content editors to view that page to filter them out.
pelms
+2  A: 

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.

cxfx
+3  A: 

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.

jdigital
I didn't even think of that (I'm running NoScript), I'll give that a shot, thanks!
You can also do this with other plugins such as AdBlock Plus.
Liam
A: 

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

AFHood
+2  A: 

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.

guns
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
also good to block the ssl version, too: ssl.google-analytics.com
Jesse Rusak
A: 

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.

Simon_Weaver