Last active
May 22, 2018 14:54
-
-
Save cadecairos/416e7abe6aab11b8317833924ed1e45d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function WebAnalytics() { | |
var _dntStatus = navigator.doNotTrack || navigator.msDoNotTrack; | |
var fxMatch = navigator.userAgent.match(/Firefox\/(\d+)/); | |
var ie10Match = navigator.userAgent.match(/MSIE 10/i); | |
var w8Match = navigator.appVersion.match(/Windows NT 6.2/); | |
if (fxMatch && Number(fxMatch[1]) < 32) { | |
_dntStatus = 'Unspecified'; | |
} else if (ie10Match && w8Match) { | |
_dntStatus = 'Unspecified'; | |
} else { | |
_dntStatus = { '0': 'Disabled', '1': 'Enabled' }[_dntStatus] || 'Unspecified'; | |
} | |
if (_dntStatus !== 'Enabled'){ | |
// Add GA JavaScript here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment