dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
14064
share rss forum feed

wolfi

join:2004-08-31

How to block google-analytics

How can i stop google analytics, using a host file ?
I am using xp pro her.



MagnusM
Premium
join:2001-07-07

2 recommendations

Insert these lines into your C:\Windows\system32\drivers\etc\hosts file:

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

You may also want to install the Ghostery plugin for your browser which will block Google Analytics and many other "tracking code" sites as well.

--
Mischel Internet Security - Developer of TrojanHunter

OZO
Premium
join:2003-01-17
kudos:2

2 recommendations

reply to wolfi

Here is my list of Google servers, that I keep in hosts file to block ubiquitous Google tracking:

# Google tracking sites:
127.0.0.1          google-analytics.com
127.0.0.1      www.google-analytics.com
127.0.0.1      ssl.google-analytics.com
127.0.0.1           googleanalytics.com
127.0.0.1       www.googleanalytics.com
127.0.0.1       ssl.googleanalytics.com
127.0.0.1         adservices.google.com
127.0.0.1  pagead.googlesyndication.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1             fusion.google.com
127.0.0.1      www.googleadservices.com
127.0.0.1  partner.googleadservices.com
127.0.0.1               doubleclick.com
127.0.0.1               doubleclick.net
127.0.0.1            ad.doubleclick.net
127.0.0.1      pubads.g.doubleclick.net
127.0.0.1                    urchin.com
127.0.0.1            service.urchin.com
 
The list is quite big, because unfortunately Windows hosts file doesn't support wildcard '*' and, therefore, each host name should be listed separately there.

--
Keep it simple, it'll become complex by itself...


JALevinworth

@embarqhsd.net
reply to MagnusM

MagnusM has got it.

Add to that this one too:

ssl.google-analytics.com
 

Also Note: Your anti-virus may see a non-standard hosts file as security threat and could possibly remove these custom entries. If that is the case, you may need to add your hosts file as an exclusion.

-Jim


JALevinworth

@embarqhsd.net

..AND OZO, has it too . My post above showed up out of order and was before OZO's reply.

Awkward..........

-Jim


Jrb2
Premium
join:2001-08-31
kudos:3
reply to wolfi

Hi,

May I make an observation about adding:

127.0.0.1 ssl.google-analytics.com
 

I see in the MVPS HOSTS file that it is commented out:
# 127.0.0.1  ssl.google-analytics.com #[disabled = Firefox issues]
 

I'm just posting this as an observation and not as a recommendation. I don't know the reasons behind it and have to leave that discussion to others.


MagnusM
Premium
join:2001-07-07
reply to wolfi

I would like to add that using the hosts file to block sites can cause slower page loading times if you don't have a web server running on localhost. The browser will have to wait for the connect to time out before determining that it cannot load the file. In addition, if you are also blocking ssl.google-analytics.com and are running a local web server then you may experience the same issue unless you also have SSL enabled for the local web server.

Also, if you have a very large hosts file, it can really slow down your machine. I have seen examples of a Windows XP box that was pretty much unusable because the hosts file had tens of thousand of entries. Clearing the hosts file fixed the problem and returned the system to its usual working state. For this reason I recommend Ghostery + Adblock instead.
--
Mischel Internet Security - Developer of TrojanHunter anti-malware



Cartel
Premium
join:2006-09-13
Chilliwack, BC
kudos:2
Reviews:
·TekSavvy DSL
·Shaw
·TELUS

1 recommendation

reply to wolfi

127.0.0.1 pagead.googlesyndication.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 adservices.google.com
127.0.0.1 ssl.google-analytics.com
127.0.0.1 www.google-analytics.com
127.0.0.1 imageads.googleadservices.com
127.0.0.1 imageads1.googleadservices.com
127.0.0.1 imageads2.googleadservices.com
127.0.0.1 imageads3.googleadservices.com
127.0.0.1 imageads4.googleadservices.com
127.0.0.1 imageads5.googleadservices.com
127.0.0.1 imageads6.googleadservices.com
127.0.0.1 imageads7.googleadservices.com
127.0.0.1 imageads8.googleadservices.com
127.0.0.1 imageads9.googleadservices.com
127.0.0.1 partner.googleadservices.com
127.0.0.1 www.googleadservices.com
127.0.0.1 apps5.oingo.com
127.0.0.1 www.appliedsemantics.com
127.0.0.1 service.urchin.com



dolphins
Clean Up Our Oceans
Premium
join:2001-08-22
Westville, NJ
kudos:7
Reviews:
·Comcast
reply to wolfi

Firefox with NoScript add-on.



OZO
Premium
join:2003-01-17
kudos:2
reply to wolfi

Keep in mind, that if you run a browser, made by Google (e.g. latest versions of Chromium), it will connect to Google analytic servers even if you block them with your hosts file.

They use directly hardcoded IP addresses (no name resolution needed). Moreover, to make the blocking harder, they require to use some of those servers to sign in into Google online accounts too... So, if you block those IP with firewall on your router, you'll not be able to sign in to your accounts. Bastards... :(
Need an example? Here it is - 74.125.129.106. Try to block it and then sign in.

BTW, to add extra confusion they assign different direct and reverse name resolutions (watch for 74.125.129.106):

D:\>nslookup google-analytics.com
...
Name:    google-analytics.com
Addresses:  74.125.129.106, 74.125.129.105, 74.125.129.147, 74.125.129.99
          74.125.129.104, 74.125.129.103 
 
Then check the 74.125.129.106 IP for it's name:
D:\>nslookup 74.125.129.106
...
Name:    pd-in-f106.1e100.net
Address:  74.125.129.106
 
And this time the IP comes with a different name - pd-in-f106.1e100.net

That's why if you want to block analytics servers from unsolicited tracking connections you have to make your own special build and remove those hardcoded IP's (quite big subset actually) directly from the browser or simply use Iron browser instead of Chromium/Chrome...

--
Keep it simple, it'll become complex by itself...


MagnusM
Premium
join:2001-07-07
reply to wolfi

The Google Analytics code is loaded via JavaScript from web pages with Google Analytics tracking enabled. This does indeed use the hostnames www.google-analytics.com and ssl.google-analytics.com. I just looked through the ga.js file and couldn't find any hard-coded IPs in there... this also wouldn't make any sense since it would circumvent the load-balancing features of using hostname resolution.
--
Mischel Internet Security - Developer of TrojanHunter anti-malware


OZO
Premium
join:2003-01-17
kudos:2

I was specifically talking about Google made browsers.

Can you block browsers from connecting to Google Analytics servers while you're browsing the Internet?
--
Keep it simple, it'll become complex by itself...



MagnusM
Premium
join:2001-07-07
reply to wolfi

Even if you use Google Chrome it's still not going to use IP addresses to access Google Analytics. If you have any links to back this up I'd love to see them.

EDIT: Try to access »74.125.129.106/ga.js in Google Chrome -- you will get a 404 error.

--
Mischel Internet Security - Developer of TrojanHunter anti-malware



NetFixer
Freedom is NOT Free
Premium
join:2004-06-24
The Boro
Reviews:
·Cingular Wireless
·Comcast Business..
·Vonage
reply to OZO

said by OZO:

The list is quite big, because unfortunately Windows hosts file doesn't support wildcard '*' and, therefore, each host name should be listed separately there.

The hosts file does not support wildcard '*' entries no matter what OS it is used on. Microsoft is not to blame for the lack of wildcard support.
--
We can never have enough of nature.
We need to witness our own limits transgressed, and some life pasturing freely where we never wander.


siljaline
I'm lovin' that double wide
Premium
join:2002-10-12
Montreal, QC
kudos:17
Reviews:
·Bell Sympatico
reply to wolfi

MVPS Hosts blocks most, examples:

# [Google Inc]
127.0.0.1 domains.googlesyndication.com #[Parking Service]
127.0.0.1 pagead2.googlesyndication.com #[Google AdWords]
127.0.0.1 video-stats.video.google.com
# 127.0.0.1 ssl.google-analytics.com #[disabled = Firefox issues]
127.0.0.1 www.google-analytics.com #[Google Analytics]
127.0.0.1 4.afs.googleadservices.com
127.0.0.1 pagead2.googleadservices.com
127.0.0.1 partner.googleadservices.com
127.0.0.1 www.googleadservices.com
127.0.0.1 apps5.oingo.com #[Microsoft.Typo-Patrol]
127.0.0.1 www.appliedsemantics.com
127.0.0.1 service.urchin.com #[Urchin Tracking Module]

Also: For IE 9 -
»ie.microsoft.com/testdrive/brows···ogle.txt

OZO
Premium
join:2003-01-17
kudos:2
reply to MagnusM

said by MagnusM:

Even if you use Google Chrome it's still not going to use IP addresses to access Google Analytics. If you have any links to back this up I'd love to see them.

Here is example of first (no any URL provided) start of Chromium browser, Version 24.0.1299.0 (162321):

Tracking connections from Chromium browser

As you can see in this session it makes 5 secure tracking connections and it uses them until I close the browser...

1) Do you know any way to stop them?

2) If I block those names with my hosts file, browser will open those connections anyway. It means one thing - browser doesn't need name resolution to connect to those servers or it uses unknown aliases for them.
--
Keep it simple, it'll become complex by itself...


MagnusM
Premium
join:2001-07-07

These are connections that Chrome uses for "safe browsing" features, to warn of malicious sites. You can turn this off in Chrome's advanced settings by unchecking "Enable phishing and malware protection".
--
Mischel Internet Security - Developer of TrojanHunter anti-malware



siljaline
I'm lovin' that double wide
Premium
join:2002-10-12
Montreal, QC
kudos:17
Reviews:
·Bell Sympatico
reply to Jrb2

I don't know why "MVPS" comments out that Firefox entry.
Presumably due to feedback from Moz users saying this entry prevents from reaching some sites.

You can comment in and out sites via notepad as deemed necessary over time with your Browsing based on the sites you visit.

Many more experienced using non-standard Hosts file users maintain their own lists that they comment in at the bottom of the file at every release.


OZO
Premium
join:2003-01-17
kudos:2

1 edit
reply to MagnusM

No, they're not. The first thing I always do is to un-check that option. The screenshot provided was taken when that option was clear too. Any other ideas?

With other run I may get other, but similar connections. If I resolve those connections and block corresponding IP's with firewall. It will try to connect to different servers. One of them I've mentioned in my earlier post:
IP = 74.125.129.106, which could be referred as google-analytics.com or pd-in-f106.1e100.net.
--
Keep it simple, it'll become complex by itself...



AVD
Respice, Adspice, Prospice
Premium
join:2003-02-06
Onion, NJ
kudos:1
reply to OZO

said by OZO:

The list is quite big, because unfortunately Windows hosts file doesn't support wildcard '*' and, therefore, each host name should be listed separately there.

technically, does *any* HOSTS file "support wildcards"?
--
--Standard disclaimers apply.--


AVD
Respice, Adspice, Prospice
Premium
join:2003-02-06
Onion, NJ
kudos:1
reply to dolphins

unless no-script blocks image loading, you can still be tracked.
--
--Standard disclaimers apply.--



siljaline
I'm lovin' that double wide
Premium
join:2002-10-12
Montreal, QC
kudos:17
Reviews:
·Bell Sympatico
reply to MagnusM

See: »Spybot & Adaware still good to use?

Under Win 7 with MVPS Hosts I leave my DNS Client on automatic but flush my DNS every once in a while.

If you've got bags on RAM, the days of disabled DNS in order not to slow your Browser are generally over.

Hosts files with too many parked entries will choke your machine.


OZO
Premium
join:2003-01-17
kudos:2
reply to AVD

said by AVD:

said by OZO:

The list is quite big, because unfortunately Windows hosts file doesn't support wildcard '*' and, therefore, each host name should be listed separately there.

technically, does *any* HOSTS file "support wildcards"?

Technically they don't. And usual explanation is - they were not designed to block name resolutions in the first place. But if they did support of '*', blocking name resolutions would be much more efficient. If you look at examples of HOSTS files usually they contain many lines referring to one domain, but specifying each and every host within that domain, one by one. If HOSTS files supported '*', many of those lines could be substituted with just one line. E.g.:
127.0.0.1 *.google-analytics.com.
--
Keep it simple, it'll become complex by itself...


dolphins
Clean Up Our Oceans
Premium
join:2001-08-22
Westville, NJ
kudos:7
Reviews:
·Comcast
reply to AVD

said by AVD:

unless no-script blocks image loading, you can still be tracked.

Yes, it does block images. It can cripple a website to the point of it being a blank page. I find it especially useful with sites that have a seemingly endless list of hotlinks.

--
Stop The Mindless Killings Stop Over Fishing


Juggernaut
Irreverent or irrelevant?
Premium
join:2006-09-05
Kelowna, BC
kudos:2

I also use AdBlockPlus in conjunction with NoScript. It's very effective.
--
I'm not anti-social, I just don't like stupid people.



siljaline
I'm lovin' that double wide
Premium
join:2002-10-12
Montreal, QC
kudos:17

1 edit

Adversity and Antisocial for ABP gives issues for heavy Facebook users.
»adversity.uk.to/
Elsewhere, it's excellent.



Dude111
An Awesome Dude
Premium
join:2003-08-04
USA
kudos:12
reply to OZO

 

quote:
The list is quite big, because unfortunately Windows hosts file doesn't support wildcard '*' and, therefore, each host name should be listed separately there.
I have always noticed that buddy,why is that?? -- Is it too hard for windows to deal with 0 " *.google.com "


NetFixer
Freedom is NOT Free
Premium
join:2004-06-24
The Boro
Reviews:
·Cingular Wireless
·Comcast Business..
·Vonage

said by Dude111:

quote:
The list is quite big, because unfortunately Windows hosts file doesn't support wildcard '*' and, therefore, each host name should be listed separately there.
I have always noticed that buddy,why is that?? -- Is it too hard for windows to deal with 0 " *.google.com "

That has been repeatedly answered in just about any thread that discusses using a hosts file for "blocking" instead of its intended purpose. The standard that defines the hosts file does not provide for wildcard entries, and neither Microsoft or Windows has anything to do with that standard (other than an obligation to comply with the standard). I suspect that if MS did decide to make their own proprietary rules for the hosts file, they would be instantly lambasted for trying to corrupt a known and accepted standard.
--
We can never have enough of nature.
We need to witness our own limits transgressed, and some life pasturing freely where we never wander.
Expand your moderator at work


Traxless
Premium
join:2005-02-16
USA
reply to wolfi

Re: How to block google-analytics

This site might help.

»ie.microsoft.com/testdrive/browser/p3p/

ttyl