It's hard for me to talk about user privacy on this blog when I have Google Analytics measuring everything you do on the website. I've tried to move away from it in the past and use the self-hosted open-source alternative but it quickly failed. When I received a burst of traffic, the server on which it was hosted crashed. I'm still looking for a self-hosted solution but in the meanwhile, I will do what I can to limit tracking by respecting users that specifically ask not to be tracked.

Every browser gives you the option not to be tracked. When you activate this option (see below), the browser sets a global variable in JavaScript navigator.doNotTrack and it is accessible to all scripts that have the intention of tracking you. At that point, it is up to those scripts to decide to respect it or not. After doing some research, I found that Google Analytics does not respect this directive. On my websites it is up to me to respect it.

So as of September 26 2018 I have added a snippet of code that will respect the Do Not Track directive.

Below is the shim that tests it:

var _doNotTrack = navigator.doNotTrack ?
        navigator.doNotTrack === "1" || navigator.doNotTrack === "yes": 
        (window.doNotTrack? window.doNotTrack === "1": false);
if (_doNotTrack){
    // do not load GA
}

For now this script will determine if you have opted out of being tracked and will prevent Google Analytics from loading.

How to set Do Not Track on you browser

Google Chrome (Version 69):

  • Enter this URL chrome://settings
  • Click on the Settings menu
  • Click on Advanced
  • Click on Privacy and security
  • Click on the option Send a "Do Not Track" request with your browsing traffic
  • You are set

Firefox:

  • Click on the browser hamburger menu (top right)
  • Click on Options
  • Click on Privacy & Security (left menu)
  • Scroll down to the section Tracking Protection
  • Select the option that is convenient to you.

Microsoft Edge:

  • Click on the browser menu (3 dots on the top right)
  • Click on Settings
  • Click on View Advanced Settings
  • Scroll down to the section Privacy and Services
  • Select Send Do Not Track requests

Safari:

  • Go to the browser settings
  • Go to Privacy & Settings
  • Click on View Advanced Settings
  • Select Do Not Track

As far as I am concerned, if users have chosen not to be tracked, they will not be tracked with Google Analytics on this website. I hope other developers will join me on making sure we respect this rule.