100

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?

mrblint
  • 833

8 Answers8

97

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
EightBitTony
  • 4,299
34

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.

gronostaj
  • 58,482
29

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.

Aaron Miller
  • 10,087
7

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.

3

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.

Ruud
  • 311
2

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.

LukeN
  • 121
  • 3
0

I did not want to block GoogleAnalticsObject because I have several projects under development, AND I want them to register if I hit the external-hosted site, so messing with the hosts file is not an option. Instead, I used an "asp:Placeholder" tag to wrap the Jscript and set visibility=false when localhost, otherwise =true. Pretty simple and does the job quietly.

0

Had this problem, just cleared the DNS cache and everything is back to normal. In Chrome go to chrome://net-internals/#dns and press clear host cache

frenchie
  • 331