Last active
February 15, 2018 16:06
-
-
Save ovlb/d0ac041e1e76a8400eb102bde13d7ff0 to your computer and use it in GitHub Desktop.
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
<script data-pixel="fb"> | |
var optOutWish = function() { | |
var doNotTrack = navigator.doNotTrack === '1'; | |
var hasOptedOut = localStorage.getItem('fb-pixel-status') === 'opt-out'; | |
return doNotTrack || hasOptedOut; | |
} | |
if (optOutWish()) { | |
console.info('User prohibits tracking. Not embedding Facebook’s script.') | |
} else { | |
console.log('Embedding Facebook’s script.'); | |
!function(f,b,e,v,n,t,s) | |
{if(f.fbq)return;n=f.fbq=function(){n.callMethod? | |
n.callMethod.apply(n,arguments):n.queue.push(arguments)}; | |
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; | |
n.queue=[];t=b.createElement(e);t.async=!0; | |
t.src=v;s=b.getElementsByTagName(e)[0]; | |
s.parentNode.insertBefore(t,s)}(window, document,'script', | |
'https://connect.facebook.net/en_US/fbevents.js'); | |
fbq('init', '1944570812537922'); | |
fbq('track', 'PageView'); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment