Skip to content

Tracking

Vincent Orback edited this page May 15, 2017 · 1 revision

Smarter/nicer tracking

// Check if people are ok with being followed.
var DoNotTrack = navigator.doNotTrack === 'yes'
  || navigator.doNotTrack === '1'
  || window.doNotTrack === '1'
  || navigator.msDoNotTrack === '1'

if (!DoNotTrack) {
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics_debug.js','ga');
  // Load analytics_debug.js to log every event in the console.

  ga('create', 'UA-XXXXXXXX-1', 'auto');
  ga('set', 'sendHitTask', null); // Don’t send any real data in development
  ga('send', 'pageview');
}
Clone this wiki locally