Paul Fawkesley

Google Analytics with Do Not Track

Respect your users’ choice for privacy — disable Google Analytics for people using Do Not Track.

Do Not Track is an HTTP header which indicates a person’s preference to opt out of tracking. Most browsers require the person to explicitly turn on this setting. You can interpret it as a clear request to avoid tracking.

It’s simple to respect your visitors’ preference for privacy. Just put any analytics tracking code inside this if statement:

This way, the analytics script won’t even be downloaded from Google’s servers. This improves your users’ privacy and slightly speeds up the page load.

Do it now!