Informacia
Treść

Dostosowywanie kodu pośredniczącego

Kod pośredniczący (część kodu, który integrujesz ze swoją witryną) automatycznie obejmuje obsługę IAB TCF v1, IAB TCF v2 i IAB USP. W niektórych przypadkach obsługa IAB TCF może powodować problemy. Aby tego uniknąć, możesz ponownie sformatować swój kod w następujący sposób:

<script>window.gdprAppliesGlobally=false; //set this to true or false depending on your needs
//no changes below this line
  window.cmp_id=123456;window.cmp_params="";
  window.cmp_host="delivery.consentmanager.net";window.cmp_cdn="cdn.consentmanager.net";function cmp_getlang(j){if(typeof(j)!="boolean"){j=true}if(j&&typeof(cmp_getlang.usedlang)=="string"&&cmp_getlang.usedlang!==""){return cmp_getlang.usedlang}var g=["DE","EN","FR","IT","NO","DA","FI","ES","PT","RO","BG","ET","EL","GA","HR","LV","LT","MT","NL","PL","SV","SK","SL","CS","HU","RU","SR","ZH"];var c=[];var f=location.hash;var e=location.search;var a="languages" in navigator?navigator.languages:[];if(f.indexOf("cmplang=")!=-1){c.push(f.substr(f.indexOf("cmplang=")+8,2))}else{if(e.indexOf("cmplang=")!=-1){c.push(e.substr(e.indexOf("cmplang=")+8,2))}else{if("cmp_setlang" in window&&window.cmp_setlang!=""){c.push(window.cmp_setlang.toUpperCase())}else{if(a.length>0){for(var d=0;d<a.length;d++){c.push(a[d])}}}}}if("language" in navigator){c.push(navigator.language)}if("userLanguage" in navigator){c.push(navigator.userLanguage)}var h="";for(var d=0;d<c.length;d++){var b=c[d].toUpperCase();if(b.indexOf("-")!=-1){b=b.substr(0,2)}if(g.indexOf(b)!=-1){h=b;break}}if(h==""){h="EN"}h=h.toUpperCase();return h}(function(){var a="";var c="_en";if("cmp_getlang" in window){a=window.cmp_getlang().toLowerCase();c="_"+a}var b=document.createElement("script");b.src="https://"+window.cmp_host+"/delivery/cmp.php?id="+window.cmp_id+"&h="+encodeURIComponent(location.href)+"&"+window.cmp_params+(document.cookie.length>0?"&__cmpfcc=1":"")+"&l="+a+"&o="+(new Date()).getTime();b.type="text/javascript";b.setAttribute("data-cmp-ab",1);b.async=true;if(document.body){document.body.appendChild(b)}else{if(document.currentScript){document.currentScript.parentElement.appendChild(b)}else{document.write(b.outerHTML)}}var b=document.createElement("script");b.src="https://"+window.cmp_cdn+"/delivery/cmp"+c+".min.js";b.type="text/javascript";b.setAttribute("data-cmp-ab",1);b.async=true;if(document.body){document.body.appendChild(b)}else{if(document.currentScript)
  {document.currentScript.parentElement.appendChild(b)}else{document.write(b.outerHTML)}}window.cmp_addFrame=function(e){if(!window.frames[e]){if(document.body){var d=document.createElement("iframe");d.style.cssText="display:none";d.name=e;document.body.appendChild(d)}else{window.setTimeout('window.cmp_addFrame("'+e+'")',10)}}};window.cmp_rc=function(j){var d=document.cookie;var g="";var f=0;while(d!=""&&f<100){f++;while(d.substr(0,1)==" "){d=d.substr(1,d.length)}var h=d.substring(0,d.indexOf("="));if(d.indexOf(";")!=-1){var e=d.substring(d.indexOf("=")+1,d.indexOf(";"))}else{var e=d.substr(d.indexOf("=")+1,d.length)}if(j==h){g=e}i=d.indexOf(";")+1;if(i==0){i=d.length}d=d.substring(i,d.length)}return(g)};window.cmp_stub=function(){var d=arguments;__cmp.a=__cmp.a||[];if(!d.length){return __cmp.a}else{if(d[0]==="ping"){if(d[1]===2){d[2]({gdprApplies:gdprAppliesGlobally,cmpLoaded:false,cmpStatus:"stub",displayStatus:"hidden",apiVersion:"2.0",cmpId:31},true)}else{d[2]({gdprAppliesGlobally:gdprAppliesGlobally,cmpLoaded:false},true)}}else{if(d[0]==="getUSPData"){d[2]({version:1,uspString:window.cmp_rc("")},true)}else{if(d[0]==="getTCData"){__cmp.a.push([].slice.apply(d))}else{if(d.length==4&&d[3]===false){d[2]({},false)}else{__cmp.a.push([].slice.apply(d))}}}}}};window.cmp_msghandler=function(h){var d=typeof h.data==="string";try{var g=d?JSON.parse(h.data):h.data}catch(j){var g=null}if(typeof(g)==="object"&&g!==null&&"__cmpCall" in g){var f=g.__cmpCall;window.__cmp(f.command,f.parameter,function(l,k){var e={__cmpReturn:{returnValue:l,success:k,callId:f.callId}};h.source.postMessage(d?JSON.stringify(e):e,"*")})}if(typeof(g)==="object"&&g!==null&&"__uspapiCall" in g){var f=g.__uspapiCall;window.__uspapi(f.command,f.version,function(l,k){var e={__uspapiReturn:{returnValue:l,success:k,callId:f.callId}};h.source.postMessage(d?JSON.stringify(e):e,"*")})}if(typeof(g)==="object"&&g!==null&&"__tcfapiCall" in g){var f=g.__tcfapiCall;window.__tcfapi(f.command,f.version,function(l,k){var e={__tcfapiReturn:{returnValue:l,success:k,callId:f.callId}};h.source.postMessage(d?JSON.stringify(e):e,"*")},f.parameter)}};window.cmp_setStub=function(d){if(!(d in window)||(typeof(window[d])!=="function"&&typeof(window[d])!=="object"&&(typeof(window[d])==="undefined"||window[d]!==null))){window[d]=window.cmp_stub;window[d].msgHandler=window.cmp_msghandler;if(window.addEventListener){window.addEventListener("message",window.cmp_msghandler,false)}else{window.attachEvent("onmessage",window.cmp_msghandler)}}};
//no changes above this line
window.cmp_addFrame("__cmpLocator"); //remove this line to remove IAB TCF v1 support
window.cmp_addFrame("__uspapiLocator"); //remove this line to remove IAB USP support
window.cmp_addFrame("__tcfapiLocator"); //remove this line to remove IAB TCF v2 support
window.cmp_setStub("__cmp"); //leave this line in the code
window.cmp_setStub("__tcfapi"); //remove this line to remove IAB TCF v2 support
window.cmp_setStub("__uspapi"); //remove this line to remove IAB USP support
//no changes below this line
})();</script>

Pamiętaj, że powyższy przykład jest wersją sformatowaną — Twój kod może być niesformatowany (bez łamania linii i komentarzy).

  1. Zmień linię window.gdprAppliesGlobally do true jeśli chcesz używać TCF globalnie. Jeśli chcesz korzystać z innych przepisów poza Europą, możesz ustawić wartość na false.
  2. Usuń linię zawierającą słowo __cmpLocator w celu usunięcia obsługi TCF v1
  3. Usuń wiersze zawierające słowa __tcfapiLocator i __tcfapi w celu usunięcia obsługi TCF v2
  4. Usuń wiersze zawierające słowa __uspapiLocator i __uspapi w celu usunięcia obsługi IAB USP
Powrót do góry