Google's official method to disable Analytics tracking and advertising cookies is to install an opt out plugin in your browser... each one of them. This takes away control from you and leaves it with Google. It will also stop functioning if you reinstall the browser clean. References are provided at the end of this article for your information.
There is however a more convenient and persistent cross-browser method to disable Google Analytics: editing a file on your device called the hosts file. This will not only increase your privacy across the web, but could also make your browsing slightly faster. Always a good thing.
You will need the administrator or root privileges, which is fine on your own desktop computer, but more involved on mobile devices. Smartphones and tablets have a hosts file too, but user needs root access to edit it, i.e. iOS limitations removed.
Windows: Click Start menu – search for “Notepad“, right-click and select “Run as Administrator“. This will prompt you to launch Notepad with higher privileges. Now, open the hosts file at C:\windows\system32\drivers\etc\ from the Notepad File menu.
OS X, Ubuntu, other desktop *NIX systems: Launch Terminal utility and type sudo nano /etc/hosts, this will ask for your password.
On all operating systems add the following lines to the bottom of the hosts file.
127.0.0.1 www.google-analytics.com # block Analytics
127.0.0.1 www.googleadservices.com # block remarketing
On Windows: Save using CTRL+S and exit.
On Unix-style OS: Save file using CTRL+X, confirm by pressing Y and exit.
Make the changes effective:
Enjoy your newly gained increased privacy.
If you'd wish to reverse the changes, use the same steps to remove the lines you added above.
This solution is browser independent and will naturally work for all browsers installed on your computer including Internet Explorer, Firefox, Safari, Chrome and Opera without any need for installation of plugins in each browser.
If you run a website with Google Analytics installed like us, this is one of the ways you can exclude your own traffic from Analytics charts, especially handy if your IP address is dynamic.
Please send your comments using feedback box below.