Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I put google-analytics (among thousands of other useless tracking websites) in my hosts file. Probably the most useful text file you'll ever download:

http://someonewhocares.org/hosts/



Author of the accepted answer here. You can block GA without breaking sites by using the GA Opt Out plugin in this specific case https://tools.google.com/dlpage/gaoptout

The reason is that blocking the domain in your hosts file will prevent the functions from ever loading, and so something like this (the standard code for doing cross-domain tracking):

    <a href="http://thirdpartycheckoutsite.com" onclick="_gaq.push(["_link"]); return false"></a>
Will cause _gaq to simply add an array with a single element, a string that says "_link", and then return false, preventing the site from completing the default action. This is because ga.js never loads, so it never executes the queue of functions and never converts gaq.push into a non-native function. So, you'll click the link, and nothing happens.

(I actually abhor the practice of doing this this way, because it's so easily breakable, but this is the "recommended" way of faciltating cross domain tracking)

If you use one of the "official" Google opt-out plugins, it'll load ga.js, but it'll block any information from being sent about you to Google, it'll block Google Analytics cookies from being sent, and it won't break any site functionality.

Will simply


How about just using Ghostery plugin in your browser? http://www.ghostery.com/

It's more user friendly and easier to modify websites that shouldn't be blocked than big hosts file.


The line for google analytics in this hosts file is commented out, with the comment "breaks some sites".

If only getting rid of spy cookies/tracking was so easy...


The list is very conservative this way, but I add a bunch of sites myself and uncommenting google-analytics and other tracking sties is perfectly safe and doesn't break anything - even google. And for cookies there's cookie monster.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: