Prevent Google Analytics from tracking your visit

Martin Brinkmann
Nov 14, 2005
Updated • Apr 29, 2013
Security
|
10

Today Google launched their free tracking tool for webmasters. It keeps track of visitor movements and clicks on the webmaster's site. There are likely some visitors who don't like their movements and clicks to be analyzed in detail.

For those digital inspiration found a way to prevent that this data is sent to Google for further analyzing. Whenever you visit a site that uses Google Analytics a small JavaScript file is downloaded to the visitors PC which reports the movement to Google.

Now, to prevent this one simply has to add a line to his windows host file, which is located in system32/drivers/etc/host for windows xp and 2000 and in hosts/ for the other windows systems.

The line that needs to be added is

127.0.0.1 www.google-analytics.com

It redirects every request made to www.google-analytics.com to 127.0.0.1 which is your own system. The script can't find the js file and therefor nothing is reported.

Simply delete the line if you want to remove this again.

Prevent Google Analytics from Tracking your Visit

Formerly known as Urchin, Google Analytics is used by webmasters to calculate how many people are visiting their sites. Unfortunately, it doesn’t stop there. The Google analytics tracking code is a small javascript, urchin.js, and it is installed on web pages with the intention of collecting user data, or in the case of online merchants, “Customer data”. What this means, in short, is that site visitors (that’s you) are tracked by utilizing a combination of server and “client-side technology”. This includes tracking cookies and adware as well as other unwanted things that will reveal as much of your personal information and browsing history to the website owner. That is just one of the ways that you end up with Spam.

This is not to state that Google is trying to spread adware cookies (?), but rather, website owners take advantage of Google Analytics to determine what sites you are visiting, how many times you click on certain product or service categories, etc. There are certainly website owners that are simply collecting the data for demographic purposes and are not dropping cookies on your operating system as though they were feeding the cookie monster. However, the reality is that is can be safely assumed that most are collecting any data about user internet activity as they can. Now the question is how to stop it?

prevent google analytics

You definitely can stop Google Analytics from tracking your site visits. It is simply a matter of going to your Windows Hosts file and inserting the following line:

127.0.0.1 www.google-analytics.com

If you do not know how to access your Hosts file, then you need to know so that you can eliminate certain sites from accessing your computer. When a line such as the one above is added to the Hosts file, the browser cannot download the urchin.js file mentioned earlier. They can still identify that you have visited a site, but they cannot tell what you do after that.

The Windows 7 hosts file is located in C:\windows\system32\drivers\etc\ or %systemroot%\system32\drivers\etc\ and cannot be edited by normal users. To edit the hosts file, Click Start – search for “Notepad“, right-click and select “Run as Administrator“.

For Windows XP, the path is C:\windows\system32\drivers\etc\hosts, much as it is in Windows 7, but you are able to readily edit it without the need to use a text editor. All Windows Hosts files are located under \drivers\etc.

Once you have accessed the Hosts file, add the line described above and this will block Google Analytics from tracking your visits to websites. There are other lines that you can add to the Hosts file to further ensure security and privacy:

127.0.0.1 adwords.google.com
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 imageads.googleadservices.com
127.0.0.1 imageads1.googleadservices.com
127.0.0.1 www.googleadservices.com
127.0.0.1 apps5.oingo.com

By including these lines in your Hosts file, you will also block Google AdSense. This gives you a greater level of privacy with your web searches and perhaps you won’t have as many pop-ups and spam coming to you. Good luck!

Advertisement

Previous Post: «
Next Post: «

Comments

  1. Rupert said on July 24, 2015 at 5:46 am
    Reply

    My suggestion is to not use ANY google ‘product’. Since they have risen to prominence, the net is a complete mess totally driven by ads and greed – GOOGLE’S GREED. Stop enabling this disgusting parasitic group and boycott everything to do with them.

    I also notice that this website is using googlesyndication.

  2. Michelle said on June 25, 2014 at 3:25 am
    Reply

    The bigger ramifications of this tracking is that Google servers are tracking your every move through the web, from the current webmasters site to other unrelated sites which use Google analytics/syndication (which are many!), this information is available to google to use for whatever nefarious purposes they want. As well as keeping track of your search terms in a google account, they now keep track of your surfing habits. A complete picture of what you are doing online, some would call it malware, others spying. The saturation level of google assets websites these days means nothing you do is private, whether you like it or not, unless you go through proxies or disable the sites as above instructions.

    Even if you do disable the cookie access to the analytics websites above, google is still able to partially track you via IP address matching on unrelated websites, although not as accurate, but together with Google accounts, just as dangerous. My suggestion to protect you when surfing is (1) logout of your google account when surfing (keep it only when using google search etc) and (2) disable google websites using the hosts file as above article

  3. jmjsquared said on January 25, 2012 at 10:31 pm
    Reply

    EDIT: My “double-space” disappeared in the post. So, I’m trying again!
    Yea: 127.0.0.1 http://www.google-analytics.com
    Nay: 127.0.0.1 http://www.google-analytics.com

  4. jmjsquared said on January 25, 2012 at 10:25 pm
    Reply

    Another tool in my toolbox (my brain, that is) is always welcomed. Whether and how I choose to use it is just that, my choice. Thanks for the info.

    I believe that there should be a double space between 127.0.0.1 and whatever comes after; for example:
    127.0.0.1 http://www.google-analytics.com rather than this:
    127.0.0.1 http://www.google-analytics.com

  5. freeMan said on January 13, 2011 at 12:58 pm
    Reply

    There are nothing “Free” If someone offers something Free there is a shadow behind it.

  6. suraci said on August 28, 2008 at 12:00 pm
    Reply

    My pc hangs while waiting for google-analytics to load. I have not asked for this everytime I visit a site and resent both the delay and the fact they data mine me. Some people are far too compalcent about invasion of privacy. Grow a spine. Look at some of the characters behind companies like Google and wise up.

  7. Oliver Aloexander said on August 9, 2006 at 6:33 pm
    Reply

    “Small script”? It’s 18000 k, and thus it slows matters noticeably over a modem connection. With brodband this kind of nonsense accumulates and ends up costing money.

  8. Martin said on November 15, 2005 at 10:39 am
    Reply

    I agree with you that even if people use this line in their host file the site admin is still able to track their movement throughout his site.

    The main reason I added this story was that I thought it incredibly brilliant to simply edit the hosts file to prevent google analytics from functioning at all.

    thanks for your comments :)

  9. Jonathan said on November 15, 2005 at 8:57 am
    Reply

    .. You act as if its spyware. Who cares if a webmaster has a little graph of how many people use whatever browser or how many people are visiting a certain page? It’s not a bad thing and alot of the time, it’s for the better. There is never a negative side to it. This is something that has been around for a long time but has costed money. Google is putting it out there for free. There is no point in this ghacks story.
    It’s for the better of the internet, so my advice is to not get rid of it. Google analytics doesn’t spy on what websites you go to, steal your passwords, or add anything to your computer.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.