Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Recently (past few weeks) my web browsing is often very slow, and it is often the case at these times that the status bar reads "waiting for www.google-analytics.com".

Is there any browser setting that will tell Google that I do not wish to be a participant in their analytics program, so the page won't even attempt to contact Google? Can individuals "opt out" of this in some way?

share|improve this question
17  
What about NoScript and similar programs? –  arne Jun 24 '13 at 13:34
3  
    
+1 to arne's comment. I block google analytics, as well as numerous other scripts, with NoScript. This is a FireFox-specific extension. –  Kaz Jun 24 '13 at 19:19
    
The design of the webpage is a factor here. If there are a small number of sites that bother you, you could raise it with them. –  Simon Gibbs Jun 25 '13 at 10:58
    
Does Google analytics get used for estimating browser usage share? Does opting out of tracking mean opting out of browser usage share statistics? –  James Haigh Jun 25 '13 at 15:35

6 Answers 6

up vote 89 down vote accepted

The 'old school' method, which works with any browser, is to add the following entry to your local hosts file,

127.0.0.1 www.google-analytics.com
127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com

This works for all browsers, regardless of whether they support plugins. As long as you don't run a web server on your local machine, these connections are instantly rejected and so don't take very long to fail.

You could also try 0.0.0.0 (never personally tested by me though).

0.0.0.0 www.google-analytics.com
0.0.0.0 google-analytics.com
0.0.0.0 ssl.google-analytics.com
share|improve this answer
32  
0.0.0.0, a null route, is better. If you're running your own web server you'll start to get 404s if your route to localhost. –  user973810 Jun 24 '13 at 15:14
2  
0.0.0.0 is not a "null route". The value has different meanings in different circumstances. In BSD-derived stacks, a 0.0.0.0 entry in the route table does represent the "default route". But the default route is not used for connection attempts to the address 0.0.0.0. –  Kaz Jun 24 '13 at 19:25
3  
Yes, it is a null route. –  user973810 Jun 24 '13 at 19:44
4  
@Sam, why would you get in trouble? –  Adrian Jun 25 '13 at 5:10
2  
These "toward myself" or "toward the end of the Internet" routing technics are slightly too late. It is much faster just to not start the TCP connection toward these spying^Wadvertisement servers. The 3 tools quoted by Gronostaj are striking there (ASAP)! –  daniel Azuelos Jun 25 '13 at 10:44

There are many solutions that take the approach of blocking requests before they are even initiated:

  • AdBlock / AdBlock Plus – It's dedicated for blocking ads, but you can configure it to block almost anything.
  • Ghostery – Its main point is taking care of your privacy, it will block GA for you (along with many other tracking scripts). RequestPolicy is its open-source alternative for Firefox.
  • NoScript / ScriptSafe / other script blockers – Blocking JavaScript entirely should solve the problem too.

Downloads for Firefox:

Downloads for Chrome:

Downloads for Opera:

Ghostery is also available for other browsers.

share|improve this answer
24  
Blocking javascript entirely to prevent Google Analytics is like blowing up a pound because a puppy peed on your rug. –  Jeff Jun 24 '13 at 21:21
15  
@Jeff: you mean, totally awesome? –  Dancrumb Jun 25 '13 at 1:00
1  
NoScript can be set to only block a blacklist: one needn't block JavaScript entirely to block scripts from some host. –  andyg0808 Jun 25 '13 at 2:37
    
3 great tools providing information (Ghostery) and protection (AdBlock & NoScript). –  daniel Azuelos Jun 25 '13 at 10:37
3  
@Jeff: No, I wasn't joking; I wasn't familiar with the US usage. But I now get your joke. :-) –  James Haigh Jun 25 '13 at 14:43

Adblock Plus or equivalent can do this for you; block anything from hostnames ending in google-analytics.com, and your browser won't even try to communicate with the service. In Adblock Plus, you'd want to add a custom filter with text ||google-analytics.com to produce this result.

share|improve this answer

For the sake of completeness, although not as easy to set up as the other solutions, you could consider running an ad blocking proxy such as Privoxy. The squid proxy can be configured to block ads as well.

Another option is to run your own DNS server and filter out the badness there, which has the same effect as blocking servers in your hosts file.

share|improve this answer
3  
+1 for dealing with these things at the proxy level. Even in small businesses, where you'd have to maintain just a handful of Firefox installations, things get easily burdensome. –  Marcello Romani Jun 25 '13 at 8:56

There is a plugin Google Disconnect for Firefox which will block Google on non-Google pages, including analytics. There is a similar plugin for Chrome, Disconnect.

share|improve this answer

I use Request Policy for firefox. It's a bit like ghostery, in that it allows you to whitelist and blacklist cross site requests, but isn't explicitly focused on privacy.

It's pretty configurable, but I set mine the blacklist by default

E.g. to use stack overflow sites:

  • I allow any requests to ajax.googleapis.com globally
  • I allow requests to stackauth.com and stackexchange.com and sstatic.com from the particular site.

Everything gets blocked and doesn't impact pageload time or allow for 3rd party tracking, but the page gets little boxes you can click to load things you didn't cover by default.

share|improve this answer

protected by nhinkle Jun 25 '13 at 16:05

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.