Created
June 15, 2018 10:32
-
-
Save zoetrope69/7d40b3094bdd19e99d6f9efaaa939f9a to your computer and use it in GitHub Desktop.
Example function that can be used to detect Do Not Track preferences server side
This file contains 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 isDoNotTrackEnabled (request) { | |
const doNotTrackHeader = request.header('DNT') | |
if (!doNotTrackHeader) { | |
return false | |
} | |
if (doNotTrackHeader.charAt(0) === '1') { | |
return true | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment