Created
July 30, 2019 12:37
-
-
Save romainbessugesmeusy/6d88dda61cb1623b0706da6fffe1ebd5 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
function launchFB(){ | |
!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', '159702201342042'); | |
fbq('set','agent','tmgoogletagmanager', '159702201342042'); | |
fbq('track', "PageView"); | |
} | |
function launchGoogleAnalytics(){ | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-00000000-1', 'auto'); | |
ga('send', 'pageview'); | |
} | |
void 0 === window._axcb && (window._axcb = []); | |
window._axcb.push(function(axeptio) { | |
axeptio.on("cookies:complete", function(choices) { | |
if(choices.facebook_pixel) { | |
launchFB(); | |
} | |
if(choices.google_analytics) { | |
loadGoogleAnalytics(); | |
} | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment