1) First of all, you need to add the following code to the head of the page before any other ad serving code (including Clickio Consent Tool code).
<script type="text/javascript">
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);
</script>
2) Your current Outbrain tag looks like this:
<div class="OUTBRAIN" data-src="DROP_PERMALINK_HERE" data-widget-id="AR_1"></div>
<script type="text/javascript">
document.querySelector(".OUTBRAIN").setAttribute('data-src', window.location.protocol + '//' + window.location.host + window.location.pathname)
</script>
<script type="text/javascript" async="async" src="//widgets.outbrain.com/outbrain.js"></script>
You need to replace current Outbrain tag by the following script:
<div class="OUTBRAIN" data-src="DROP_PERMALINK_HERE" data-widget-id="AR_1"></div>
<script type="text/javascript">
(function(d,w){
consentCallbackQueue.push(function () {
d.querySelector(".OUTBRAIN").setAttribute('data-src', w.location.protocol + '//' + w.location.host + w.location.pathname)
let u = "https://widgets.outbrain.com/outbrain.js";
if(!d.querySelector("script[src=\"" + u + "\"]")) {
let s = d.createElement("script");
s.src = u;
s.async = "async";
d.querySelector("head").appendChild(s);
}
});
})(document, window);
</script>
Comments