clickio

Facebook picel with consent queue

Oct 28th, 2020
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.19 KB | None | 0 0
  1. <!-- It's Clickio Consent Queue script. It should be placed before all of consent, ads, facebook scripts in the <head> -->
  2. <script type="text/javascript">
  3.   var googletag=googletag||{};
  4.   googletag.cmd=googletag.cmd||[];
  5.   googletag.cmd.unshift(function(){window.googletag.pubads().disableInitialLoad()});
  6.   var adsbygoogle=window.adsbygoogle||[];
  7.   adsbygoogle.pauseAdRequests=1;
  8.   var consentCallbackQueue=function(e,o){var t=!1,n=!1;let a=[],g=!1,l=!1,s=function(){g=!0,a.map(function(e,o){void 0!==e&&(e(t,n),a[o]=void 0)})};return document.documentElement.addEventListener("clickioConsentEvent",function(o){var a;a=o.detail.state,l=!0,null===a?(t=!0,n=!0,s()):-1===a||(0===a?(t=!1,n=!1,s()):1===a&&(t=!!e.__lxG__consent__.getGoogleConsentMode(),n=!!e.__lxG__consent__.getPurposeOneAllowed(),s()))},!1),setTimeout(function(){l||document.documentElement.dispatchEvent(new CustomEvent("clickioConsentEvent",{detail:{state:0}}))},5e3),{push:function(e){g?e(t,n):a.push(e)}}}(window);
  9.   function displayAndRefreshSlotById(e){consentCallbackQueue.push(function(o,t){o&&googletag.cmd.push(function(){googletag.pubads().isInitialLoadDisabled()?googletag.pubads().getSlots().forEach(function(o){o.getSlotElementId()==e&&(googletag.display(e),googletag.pubads().refresh([o]))}):googletag.display(e)})})}
  10.  consentCallbackQueue.push(function(e,o){e&&(adsbygoogle.pauseAdRequests=0)});
  11. </script>
  12.  
  13.  
  14. <!-- Should be after previous script and after script on screenshot (https://clickio.gyazo.com/8f88d50d6938fedf7e60e802f10c6522), but before any FaceBook scripts, desirable in the <head> element-->
  15. <script>
  16. function cl_fb_consent() {
  17.     ! function(f, b, e, v, n, t, s) {
  18.         if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  19.   n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  20.   if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  21.   n.queue=[];t=b.createElement(e);t.async=!0;
  22.   t.src=v;s=b.getElementsByTagName(e)[0];
  23.   s.parentNode.insertBefore(t,s)}(window, document,'script',
  24.   'https://connect.facebook.net/en_US/fbevents.js');
  25.     fbq('consent', 'revoke');
  26.     consentCallbackQueue.push(function(e,o){e&&(fbq('consent', 'grant');)});
  27. }
  28. window.REBELMOUSE_TASKS_QUEUE.push(cl_fb_consent);
  29. </script>
Add Comment
Please, Sign In to add comment