Skip to content

Instantly share code, notes, and snippets.

@zoetrope69
Created June 15, 2018 10:32
Show Gist options
  • Save zoetrope69/7d40b3094bdd19e99d6f9efaaa939f9a to your computer and use it in GitHub Desktop.
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
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