Wordsligner • Dissident • Webwright

Do Not Track Support

Published 28 June 2017

Came upon a neat EFF page describing privacy best practices for working with Privacy Badger and similar tools, so I figured it’s no big deal to add it.

The new page is here.

I don’t use any fancy tracking, but it’s pretty simple to comply with Google analytics. You have three options.

The easiest way is to simply not load GA at all:

if (!navigator.doNotTrack) { // include GA code snippet }

If you’ve got deeper GA integration and don’t want to lose the ga code, Google’s Docs on Cookies and User Identification also allow you to remove cookie storage:

var gaOpts = {};
if (navigator.doNotTrack) {
  gaOpts.storage = 'none';
}
ga('create', gaAccountId, gaOpts);

And lastly, you can enable GA Opt-Out:

window['ga-disable-' + gaAccountId] = !!navigator.doNotTrack;

It’s a good time to show your users you care about their privacy, and respecting Do Not Trakc is a great way to do it.