Created
May 13, 2020 22:25
-
-
Save joshuap/4b162e889cc504aed0b78920c3a1adf1 to your computer and use it in GitHub Desktop.
How to respect Do Not Track (DNT) https://www.honeybadger.io/do-not-track/
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
<!-- Do Not Track --> | |
<script type="text/javascript"> | |
// Global | |
window.trackingEnabled = function() { | |
var dnt = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack; | |
return !(dnt === "1" || dnt === "yes"); | |
}(); | |
</script> | |
<!-- Google Tag Manager, Segment, etc. --> | |
<script> | |
if (trackingEnabled) { | |
// Put tracking snippets here | |
} | |
</script> | |
<!-- Google Tag Manager, Segment, etc. --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment