I hereby claim:
- I am ovlb on github.
- I am ovlb (https://keybase.io/ovlb) on keybase.
- I have a public key ASDJhlVCd9yxN6Fy3sQddUNW0wn2ghQlPw_1BnzGtbt8Rgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
this.$optOutButton.addEventListener(‘click’, (e) => { | |
// Verhindern, dass der Link irgendwohin linkt | |
e.preventDefault() | |
// Eigene Funktion, um den Opt Out-Status zu setzen | |
this.optOutController() | |
}) |
setStorage(value) { | |
if (value === 'opt-in' || value === 'opt-out') { | |
// this.options.localStorageKey = fb-pixel-status | |
localStorage.setItem(this.options.localStorageKey, value) | |
} else | |
console.error('Invalid state. Use opt-in or opt-out.') | |
} | |
} |
disableTrackingFunction() { | |
delete window.fbq | |
} |
$testButton.addEventListener('click', (e) => { | |
if (localStorage.getItem('fb-pixel-status') === 'opt-in') { | |
window.fbq('trackCustom', 'PixelOptInTest') | |
} | |
// More code, probably | |
}) |
$testButton.addEventListener('click', (e) => { | |
e.preventDefault() | |
// In a real app there will probably be more logic to an input then just | |
// emitting an event. Therefore we check if fbq is defined | |
// to avoid exceptions after deactivating tracking | |
if (window.hasOwnProperty('fbq')) { | |
window.fbq('trackCustom', 'PixelOptOutTest') | |
} | |
}) |
optInController() { | |
FacebookPixelController.setStorage('opt-in') | |
FacebookPixelController.setCookie('opt-in') | |
const s = FacebookPixelController.createTrackingScript() | |
document.body.appendChild(s) | |
} |
createTrackingScript() { | |
const script = document.createElement('script') | |
script.innerText = `!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', |
<?php $do_not_track = isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] === 1; ?> |
function() { | |
return (navigator.doNotTrack || localstorage.getItem('fb-pixel-status') === 'opt-out') | |
} |