Skip to content

Instantly share code, notes, and snippets.

@ovlb
Created February 14, 2018 15:55
Show Gist options
  • Select an option

  • Save ovlb/3cb25795e0096b66e0a2885508708918 to your computer and use it in GitHub Desktop.

Select an option

Save ovlb/3cb25795e0096b66e0a2885508708918 to your computer and use it in GitHub Desktop.
// Check current status
const optOutWish = () => {
const doNotTrack = navigator.doNotTrack === '1'
const hasOptedOut = localStorage.getItem('fb-pixel-status') === 'opt-out'
return doNotTrack || hasOptedOut
}
// Output to an element in the document
const setDebugStatus = () => {
$status = document.querySelector('.js-opt-out-status')
const optOut = optOutWish()
const text = optOut ? 'Pixel ist deaktiviert.' : 'Pixel ist aktiviert.'
$status.innerText = text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment