How do I block Google Analytics on my local machine/testing environment?
You’ll need to add the google servers to your host file.
For Mac:
I manage mine with Gas Mask for Mac (download):
You’ll need to add these two lines:
127.0.0.1 www.google-analytics.com
127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com
If you’re on a PC:
Open your hosts file with a text editor to windows/system32/drivers/etc/hosts
You’ll need to add these two lines:
127.0.0.1 www.google-analytics.com
127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com
Restart your browser, especially if you’re using IE.