CMP API usage (TCF v2)
Introduction
As an approved IAB Consent Management Platform, Clickio Consent Tool fully supports the standardized CMP Javascript API for user consent data retrieval.
The API is already widely used by different demand sources and mediation solutions to determine user consent state, so there may be no additional steps needed from the site owner to make it work and comply with the GDPR except for Clickio CMP code install.
Non-EU visitors and CMP API
By default, the non-EU version of the Consent Tool code (automatically served by our geo-aware CDN) does not include CMP API functionality (to minimize load traffic/time and boost web vitals), but that is server-side configurable - feel free to contact support if you need it.
General information
The current version API documentation can be found here. Clickio CMP API implementation fully supports all the described functionality.
When implementing the CMP API integration, you should bear in mind that it loads asynchronously, so you can not directly call __tcfapi
function to pass commands from your scripts. Avoid implementing any await cycles/timeouts, which create parasitic load or delays. Instead, you can use a simple CMP API stub, which gracefully handles all the calls for you, while the full code loads.
<script type="text/javascript">
!function(){"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,r){return t(r={exports:{}},r.exports),r.exports}var n,o,i=function(t){return t&&t.Math==Math&&t},c=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r&&r)||function(){return this}()||Function("return this")(),u=function(t){try{return!!t()}catch(t){return!0}},a=!u((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),f={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,l={f:s&&!f.call({1:2},1)?function(t){var r=s(this,t);return!!r&&r.enumerable}:f},p=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}},y={}.toString,v=function(t){return y.call(t).slice(8,-1)},g="".split,b=u((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==v(t)?g.call(t,""):Object(t)}:Object,d=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},h=function(t){return b(d(t))},m=function(t){return"function"==typeof t},S=function(t){return"object"==typeof t?null!==t:m(t)},O=function(t){return m(t)?t:void 0},w=function(t,r){return arguments.length<2?O(c[t]):c[t]&&c[t][r]},j=w("navigator","userAgent")||"",T=c.process,P=c.Deno,L=T&&T.versions||P&&P.version,E=L&&L.v8;E?o=(n=E.split("."))[0]<4?1:n[0]+n[1]:j&&(!(n=j.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=j.match(/Chrome\/(\d+)/))&&(o=n[1]);var _=o&&+o,A=!!Object.getOwnPropertySymbols&&!u((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&_&&_<41})),I=A&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,k=I?function(t){return"symbol"==typeof t}:function(t){var r=w("Symbol");return m(r)&&Object(t)instanceof r},x=function(t){if(m(t))return t;throw TypeError(function(t){try{return String(t)}catch(t){return"Object"}}(t)+" is not a function")},R=function(t,r){try{Object.defineProperty(c,t,{value:r,configurable:!0,writable:!0})}catch(e){c[t]=r}return r},C=c["__core-js_shared__"]||R("__core-js_shared__",{}),F=e((function(t){(t.exports=function(t,r){return C[t]||(C[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.18.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),M=function(t){return Object(d(t))},N={}.hasOwnProperty,G=Object.hasOwn||function(t,r){return N.call(M(t),r)},D=0,V=Math.random(),z=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++D+V).toString(36)},B=F("wks"),U=c.Symbol,W=I?U:U&&U.withoutSetter||z,H=function(t){return G(B,t)&&(A||"string"==typeof B[t])||(A&&G(U,t)?B[t]=U[t]:B[t]=W("Symbol."+t)),B[t]},J=H("toPrimitive"),X=function(t){var r=function(t,r){if(!S(t)||k(t))return t;var e,n,o=null==(e=t[J])?void 0:x(e);if(o){if(void 0===r&&(r="default"),n=o.call(t,r),!S(n)||k(n))return n;throw TypeError("Can't convert object to primitive value")}return void 0===r&&(r="number"),function(t,r){var e,n;if("string"===r&&m(e=t.toString)&&!S(n=e.call(t)))return n;if(m(e=t.valueOf)&&!S(n=e.call(t)))return n;if("string"!==r&&m(e=t.toString)&&!S(n=e.call(t)))return n;throw TypeError("Can't convert object to primitive value")}(t,r)}(t,"string");return k(r)?r:String(r)},$=c.document,Y=S($)&&S($.createElement),q=function(t){return Y?$.createElement(t):{}},K=!a&&!u((function(){return 7!=Object.defineProperty(q("div"),"a",{get:function(){return 7}}).a})),Q=Object.getOwnPropertyDescriptor,Z={f:a?Q:function(t,r){if(t=h(t),r=X(r),K)try{return Q(t,r)}catch(t){}if(G(t,r))return p(!l.f.call(t,r),t[r])}},tt=function(t){if(S(t))return t;throw TypeError(String(t)+" is not an object")},rt=Object.defineProperty,et={f:a?rt:function(t,r,e){if(tt(t),r=X(r),tt(e),K)try{return rt(t,r,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(t[r]=e.value),t}},nt=a?function(t,r,e){return et.f(t,r,p(1,e))}:function(t,r,e){return t[r]=e,t},ot=Function.toString;m(C.inspectSource)||(C.inspectSource=function(t){return ot.call(t)});var it,ct,ut,at=C.inspectSource,ft=c.WeakMap,st=m(ft)&&/native code/.test(at(ft)),lt=F("keys"),pt=function(t){return lt[t]||(lt[t]=z(t))},yt={},vt=c.WeakMap;if(st||C.state){var gt=C.state||(C.state=new vt),bt=gt.get,dt=gt.has,ht=gt.set;it=function(t,r){if(dt.call(gt,t))throw new TypeError("Object already initialized");return r.facade=t,ht.call(gt,t,r),r},ct=function(t){return bt.call(gt,t)||{}},ut=function(t){return dt.call(gt,t)}}else{var mt=pt("state");yt[mt]=!0,it=function(t,r){if(G(t,mt))throw new TypeError("Object already initialized");return r.facade=t,nt(t,mt,r),r},ct=function(t){return G(t,mt)?t[mt]:{}},ut=function(t){return G(t,mt)}}var St={set:it,get:ct,has:ut,enforce:function(t){return ut(t)?ct(t):it(t,{})},getterFor:function(t){return function(r){var e;if(!S(r)||(e=ct(r)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return e}}},Ot=Function.prototype,wt=a&&Object.getOwnPropertyDescriptor,jt=G(Ot,"name"),Tt={EXISTS:jt,PROPER:jt&&"something"===function(){}.name,CONFIGURABLE:jt&&(!a||a&&wt(Ot,"name").configurable)},Pt=e((function(t){var r=Tt.CONFIGURABLE,e=St.get,n=St.enforce,o=String(String).split("String");(t.exports=function(t,e,i,u){var a,f=!!u&&!!u.unsafe,s=!!u&&!!u.enumerable,l=!!u&&!!u.noTargetGet,p=u&&void 0!==u.name?u.name:e;m(i)&&("Symbol("===String(p).slice(0,7)&&(p="["+String(p).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!G(i,"name")||r&&i.name!==p)&&nt(i,"name",p),(a=n(i)).source||(a.source=o.join("string"==typeof p?p:""))),t!==c?(f?!l&&t[e]&&(s=!0):delete t[e],s?t[e]=i:nt(t,e,i)):s?t[e]=i:R(e,i)})(Function.prototype,"toString",(function(){return m(this)&&e(this).source||at(this)}))})),Lt=Math.ceil,Et=Math.floor,_t=function(t){return isNaN(t=+t)?0:(t>0?Et:Lt)(t)},At=Math.min,It=function(t){return t>0?At(_t(t),9007199254740991):0},kt=Math.max,xt=Math.min,Rt=function(t){return function(r,e,n){var o,i=h(r),c=It(i.length),u=function(t,r){var e=_t(t);return e<0?kt(e+r,0):xt(e,r)}(n,c);if(t&&e!=e){for(;c>u;)if((o=i[u++])!=o)return!0}else for(;c>u;u++)if((t||u in i)&&i[u]===e)return t||u||0;return!t&&-1}},Ct=(Rt(!0),Rt(!1)),Ft=function(t,r){var e,n=h(t),o=0,i=[];for(e in n)!G(yt,e)&&G(n,e)&&i.push(e);for(;r.length>o;)G(n,e=r[o++])&&(~Ct(i,e)||i.push(e));return i},Mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Nt=Mt.concat("length","prototype"),Gt={f:Object.getOwnPropertyNames||function(t){return Ft(t,Nt)}},Dt={f:Object.getOwnPropertySymbols},Vt=w("Reflect","ownKeys")||function(t){var r=Gt.f(tt(t)),e=Dt.f;return e?r.concat(e(t)):r},zt=function(t,r){for(var e=Vt(r),n=et.f,o=Z.f,i=0;i<e.length;i++){var c=e[i];G(t,c)||n(t,c,o(r,c))}},Bt=/#|\.prototype\./,Ut=function(t,r){var e=Ht[Wt(t)];return e==Xt||e!=Jt&&(m(r)?u(r):!!r)},Wt=Ut.normalize=function(t){return String(t).replace(Bt,".").toLowerCase()},Ht=Ut.data={},Jt=Ut.NATIVE="N",Xt=Ut.POLYFILL="P",$t=Ut,Yt=Z.f,qt=function(t,r){var e,n,o,i,u,a=t.target,f=t.global,s=t.stat;if(e=f?c:s?c[a]||R(a,{}):(c[a]||{}).prototype)for(n in r){if(i=r[n],o=t.noTargetGet?(u=Yt(e,n))&&u.value:e[n],!$t(f?n:a+(s?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;zt(i,o)}(t.sham||o&&o.sham)&&nt(i,"sham",!0),Pt(e,n,i,t)}},Kt=Array.isArray||function(t){return"Array"==v(t)},Qt={};Qt[H("toStringTag")]="z";var Zt,tr="[object z]"===String(Qt),rr=H("toStringTag"),er="Arguments"==v(function(){return arguments}()),nr=tr?v:function(t){var r,e,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,r){try{return t[r]}catch(t){}}(r=Object(t),rr))?e:er?v(r):"Object"==(n=v(r))&&m(r.callee)?"Arguments":n},or=function(t){if("Symbol"===nr(t))throw TypeError("Cannot convert a Symbol value to a string");return String(t)},ir=Object.keys||function(t){return Ft(t,Mt)},cr=a?Object.defineProperties:function(t,r){tt(t);for(var e,n=ir(r),o=n.length,i=0;o>i;)et.f(t,e=n[i++],r[e]);return t},ur=w("document","documentElement"),ar=pt("IE_PROTO"),fr=function(){},sr=function(t){return"<script>"+t+"<\/script>"},lr=function(t){t.write(sr("")),t.close();var r=t.parentWindow.Object;return t=null,r},pr=function(){try{Zt=new ActiveXObject("htmlfile")}catch(t){}var t,r;pr="undefined"!=typeof document?document.domain&&Zt?lr(Zt):((r=q("iframe")).style.display="none",ur.appendChild(r),r.src=String("javascript:"),(t=r.contentWindow.document).open(),t.write(sr("document.F=Object")),t.close(),t.F):lr(Zt);for(var e=Mt.length;e--;)delete pr.prototype[Mt[e]];return pr()};yt[ar]=!0;var yr=Object.create||function(t,r){var e;return null!==t?(fr.prototype=tt(t),e=new fr,fr.prototype=null,e[ar]=t):e=pr(),void 0===r?e:cr(e,r)},vr=Gt.f,gr={}.toString,br="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],dr={f:function(t){return br&&"[object Window]"==gr.call(t)?function(t){try{return vr(t)}catch(t){return br.slice()}}(t):vr(h(t))}},hr={f:H},mr=c,Sr=et.f,Or=function(t){var r=mr.Symbol||(mr.Symbol={});G(r,t)||Sr(r,t,{value:hr.f(t)})},wr=et.f,jr=H("toStringTag"),Tr=function(t,r,e){t&&!G(t=e?t:t.prototype,jr)&&wr(t,jr,{configurable:!0,value:r})},Pr=[],Lr=w("Reflect","construct"),Er=/^\s*(?:class|function)\b/,_r=Er.exec,Ar=!Er.exec((function(){})),Ir=function(t){if(!m(t))return!1;try{return Lr(Object,Pr,t),!0}catch(t){return!1}},kr=!Lr||u((function(){var t;return Ir(Ir.call)||!Ir(Object)||!Ir((function(){t=!0}))||t}))?function(t){if(!m(t))return!1;switch(nr(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return Ar||!!_r.call(Er,at(t))}:Ir,xr=H("species"),Rr=function(t,r){return new(function(t){var r;return Kt(t)&&(r=t.constructor,(kr(r)&&(r===Array||Kt(r.prototype))||S(r)&&null===(r=r[xr]))&&(r=void 0)),void 0===r?Array:r}(t))(0===r?0:r)},Cr=[].push,Fr=function(t){var r=1==t,e=2==t,n=3==t,o=4==t,i=6==t,c=7==t,u=5==t||i;return function(a,f,s,l){for(var p,y,v=M(a),g=b(v),d=function(t,r,e){return x(t),void 0===r?t:function(e,n,o){return t.call(r,e,n,o)}}(f,s),h=It(g.length),m=0,S=l||Rr,O=r?S(a,h):e||c?S(a,0):void 0;h>m;m++)if((u||m in g)&&(y=d(p=g[m],m,v),t))if(r)O[m]=y;else if(y)switch(t){case 3:return!0;case 5:return p;case 6:return m;case 2:Cr.call(O,p)}else switch(t){case 4:return!1;case 7:Cr.call(O,p)}return i?-1:n||o?o:O}},Mr=[Fr(0),Fr(1),Fr(2),Fr(3),Fr(4),Fr(5),Fr(6),Fr(7)][0],Nr=pt("hidden"),Gr=H("toPrimitive"),Dr=St.set,Vr=St.getterFor("Symbol"),zr=Object.prototype,Br=c.Symbol,Ur=w("JSON","stringify"),Wr=Z.f,Hr=et.f,Jr=dr.f,Xr=l.f,$r=F("symbols"),Yr=F("op-symbols"),qr=F("string-to-symbol-registry"),Kr=F("symbol-to-string-registry"),Qr=F("wks"),Zr=c.QObject,te=!Zr||!Zr.prototype||!Zr.prototype.findChild,re=a&&u((function(){return 7!=yr(Hr({},"a",{get:function(){return Hr(this,"a",{value:7}).a}})).a}))?function(t,r,e){var n=Wr(zr,r);n&&delete zr[r],Hr(t,r,e),n&&t!==zr&&Hr(zr,r,n)}:Hr,ee=function(t,r){var e=$r[t]=yr(Br.prototype);return Dr(e,{type:"Symbol",tag:t,description:r}),a||(e.description=r),e},ne=function(t,r,e){t===zr&&ne(Yr,r,e),tt(t);var n=X(r);return tt(e),G($r,n)?(e.enumerable?(G(t,Nr)&&t[Nr][n]&&(t[Nr][n]=!1),e=yr(e,{enumerable:p(0,!1)})):(G(t,Nr)||Hr(t,Nr,p(1,{})),t[Nr][n]=!0),re(t,n,e)):Hr(t,n,e)},oe=function(t,r){tt(t);var e=h(r),n=ir(e).concat(ae(e));return Mr(n,(function(r){a&&!ie.call(e,r)||ne(t,r,e[r])})),t},ie=function(t){var r=X(t),e=Xr.call(this,r);return!(this===zr&&G($r,r)&&!G(Yr,r))&&(!(e||!G(this,r)||!G($r,r)||G(this,Nr)&&this[Nr][r])||e)},ce=function(t,r){var e=h(t),n=X(r);if(e!==zr||!G($r,n)||G(Yr,n)){var o=Wr(e,n);return!o||!G($r,n)||G(e,Nr)&&e[Nr][n]||(o.enumerable=!0),o}},ue=function(t){var r=Jr(h(t)),e=[];return Mr(r,(function(t){G($r,t)||G(yt,t)||e.push(t)})),e},ae=function(t){var r=t===zr,e=Jr(r?Yr:h(t)),n=[];return Mr(e,(function(t){!G($r,t)||r&&!G(zr,t)||n.push($r[t])})),n};if(A||(Pt((Br=function(){if(this instanceof Br)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?or(arguments[0]):void 0,r=z(t),e=function(t){this===zr&&e.call(Yr,t),G(this,Nr)&&G(this[Nr],r)&&(this[Nr][r]=!1),re(this,r,p(1,t))};return a&&te&&re(zr,r,{configurable:!0,set:e}),ee(r,t)}).prototype,"toString",(function(){return Vr(this).tag})),Pt(Br,"withoutSetter",(function(t){return ee(z(t),t)})),l.f=ie,et.f=ne,Z.f=ce,Gt.f=dr.f=ue,Dt.f=ae,hr.f=function(t){return ee(H(t),t)},a&&(Hr(Br.prototype,"description",{configurable:!0,get:function(){return Vr(this).description}}),Pt(zr,"propertyIsEnumerable",ie,{unsafe:!0}))),qt({global:!0,wrap:!0,forced:!A,sham:!A},{Symbol:Br}),Mr(ir(Qr),(function(t){Or(t)})),qt({target:"Symbol",stat:!0,forced:!A},{for:function(t){var r=or(t);if(G(qr,r))return qr[r];var e=Br(r);return qr[r]=e,Kr[e]=r,e},keyFor:function(t){if(!k(t))throw TypeError(t+" is not a symbol");if(G(Kr,t))return Kr[t]},useSetter:function(){te=!0},useSimple:function(){te=!1}}),qt({target:"Object",stat:!0,forced:!A,sham:!a},{create:function(t,r){return void 0===r?yr(t):oe(yr(t),r)},defineProperty:ne,defineProperties:oe,getOwnPropertyDescriptor:ce}),qt({target:"Object",stat:!0,forced:!A},{getOwnPropertyNames:ue,getOwnPropertySymbols:ae}),qt({target:"Object",stat:!0,forced:u((function(){Dt.f(1)}))},{getOwnPropertySymbols:function(t){return Dt.f(M(t))}}),Ur){var fe=!A||u((function(){var t=Br();return"[null]"!=Ur([t])||"{}"!=Ur({a:t})||"{}"!=Ur(Object(t))}));qt({target:"JSON",stat:!0,forced:fe},{stringify:function(t,r,e){for(var n,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(n=r,(S(r)||void 0!==t)&&!k(t))return Kt(r)||(r=function(t,r){if(m(n)&&(r=n.call(this,t,r)),!k(r))return r}),o[1]=r,Ur.apply(null,o)}})}if(!Br.prototype[Gr]){var se=Br.prototype.valueOf;Pt(Br.prototype,Gr,(function(){return se.apply(this,arguments)}))}Tr(Br,"Symbol"),yt[Nr]=!0;var le=et.f,pe=c.Symbol;if(a&&m(pe)&&(!("description"in pe.prototype)||void 0!==pe().description)){var ye={},ve=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),r=this instanceof ve?new pe(t):void 0===t?pe():pe(t);return""===t&&(ye[r]=!0),r};zt(ve,pe);var ge=ve.prototype=pe.prototype;ge.constructor=ve;var be=ge.toString,de="Symbol(test)"==String(pe("test")),he=/^Symbol\((.*)\)[^)]+$/;le(ge,"description",{configurable:!0,get:function(){var t=S(this)?this.valueOf():this,r=be.call(t);if(G(ye,t))return"";var e=de?r.slice(7,-1):r.replace(he,"$1");return""===e?void 0:e}}),qt({global:!0,forced:!0},{Symbol:ve})}var me=tr?{}.toString:function(){return"[object "+nr(this)+"]"};tr||Pt(Object.prototype,"toString",me,{unsafe:!0}),Or("iterator");var Se=H("unscopables"),Oe=Array.prototype;null==Oe[Se]&&et.f(Oe,Se,{configurable:!0,value:yr(null)});var we,je,Te,Pe=function(t){Oe[Se][t]=!0},Le=!u((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Ee=pt("IE_PROTO"),_e=Object.prototype,Ae=Le?Object.getPrototypeOf:function(t){var r=M(t);if(G(r,Ee))return r[Ee];var e=r.constructor;return m(e)&&r instanceof e?e.prototype:r instanceof Object?_e:null},Ie=H("iterator"),ke=!1;[].keys&&("next"in(Te=[].keys())?(je=Ae(Ae(Te)))!==Object.prototype&&(we=je):ke=!0),(null==we||u((function(){var t={};return we[Ie].call(t)!==t})))&&(we={}),m(we[Ie])||Pt(we,Ie,(function(){return this}));var xe={IteratorPrototype:we,BUGGY_SAFARI_ITERATORS:ke},Re=xe.IteratorPrototype,Ce=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,e={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(e,[]),r=e instanceof Array}catch(t){}return function(e,n){return tt(e),function(t){if("object"==typeof t||m(t))return t;throw TypeError("Can't set "+String(t)+" as a prototype")}(n),r?t.call(e,n):e.__proto__=n,e}}():void 0),Fe=Tt.PROPER,Me=Tt.CONFIGURABLE,Ne=xe.IteratorPrototype,Ge=xe.BUGGY_SAFARI_ITERATORS,De=H("iterator"),Ve=function(){return this},ze=function(t,r,e,n,o,i,c){!function(t,r,e){var n=r+" Iterator";t.prototype=yr(Re,{next:p(1,e)}),Tr(t,n,!1)}(e,r,n);var u,a,f,s=function(t){if(t===o&&b)return b;if(!Ge&&t in v)return v[t];switch(t){case"keys":case"values":case"entries":return function(){return new e(this,t)}}return function(){return new e(this)}},l=r+" Iterator",y=!1,v=t.prototype,g=v[De]||v["@@iterator"]||o&&v[o],b=!Ge&&g||s(o),d="Array"==r&&v.entries||g;if(d&&(u=Ae(d.call(new t)))!==Object.prototype&&u.next&&(Ae(u)!==Ne&&(Ce?Ce(u,Ne):m(u[De])||Pt(u,De,Ve)),Tr(u,l,!0)),Fe&&"values"==o&&g&&"values"!==g.name&&(Me?nt(v,"name","values"):(y=!0,b=function(){return g.call(this)})),o)if(a={values:s("values"),keys:i?b:s("keys"),entries:s("entries")},c)for(f in a)(Ge||y||!(f in v))&&Pt(v,f,a[f]);else qt({target:r,proto:!0,forced:Ge||y},a);return v[De]!==b&&Pt(v,De,b,{name:o}),a},Be=St.set,Ue=St.getterFor("Array Iterator"),We=ze(Array,"Array",(function(t,r){Be(this,{type:"Array Iterator",target:h(t),index:0,kind:r})}),(function(){var t=Ue(this),r=t.target,e=t.kind,n=t.index++;return!r||n>=r.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==e?{value:n,done:!1}:"values"==e?{value:r[n],done:!1}:{value:[n,r[n]],done:!1}}),"values");Pe("keys"),Pe("values"),Pe("entries");var He=function(t){return function(r,e){var n,o,i=or(d(r)),c=_t(e),u=i.length;return c<0||c>=u?t?"":void 0:(n=i.charCodeAt(c))<55296||n>56319||c+1===u||(o=i.charCodeAt(c+1))<56320||o>57343?t?i.charAt(c):n:t?i.slice(c,c+2):o-56320+(n-55296<<10)+65536}},Je=(He(!1),He(!0)),Xe=St.set,$e=St.getterFor("String Iterator");ze(String,"String",(function(t){Xe(this,{type:"String Iterator",string:or(t),index:0})}),(function(){var t,r=$e(this),e=r.string,n=r.index;return n>=e.length?{value:void 0,done:!0}:(t=Je(e,n),r.index+=t.length,{value:t,done:!1})}));var Ye={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},qe=q("span").classList,Ke=qe&&qe.constructor&&qe.constructor.prototype,Qe=Ke===Object.prototype?void 0:Ke,Ze=H("iterator"),tn=H("toStringTag"),rn=We.values,en=function(t,r){if(t){if(t[Ze]!==rn)try{nt(t,Ze,rn)}catch(r){t[Ze]=rn}if(t[tn]||nt(t,tn,r),Ye[r])for(var e in We)if(t[e]!==We[e])try{nt(t,e,We[e])}catch(r){t[e]=We[e]}}};for(var nn in Ye)en(c[nn]&&c[nn].prototype,nn);en(Qe,"DOMTokenList");var on=Tt.EXISTS,cn=et.f,un=Function.prototype,an=un.toString,fn=/^\s*function ([^ (]*)/;a&&!on&&cn(un,"name",{configurable:!0,get:function(){try{return an.call(this).match(fn)[1]}catch(t){return""}}});var sn="\t\n\v\f\r \u2028\u2029\ufeff",ln="["+sn+"]",pn=RegExp("^"+ln+ln+"*"),yn=RegExp(ln+ln+"*$"),vn=function(t){return function(r){var e=or(d(r));return 1&t&&(e=e.replace(pn,"")),2&t&&(e=e.replace(yn,"")),e}},gn=(vn(1),vn(2),vn(3)),bn=c.parseInt,dn=c.Symbol,hn=dn&&dn.iterator,mn=/^[+-]?0[Xx]/,Sn=8!==bn(sn+"08")||22!==bn(sn+"0x16")||hn&&!u((function(){bn(Object(hn))}))?function(t,r){var e=gn(or(t));return bn(e,r>>>0||(mn.test(e)?16:10))}:bn;qt({global:!0,forced:parseInt!=Sn},{parseInt:Sn}),e((function(r){function e(r){return(e="function"==typeof Symbol&&"symbol"==t(Symbol.iterator)?function(r){return t(r)}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":t(r)})(r)}r.exports=function(){for(var t,r,n="__tcfapiLocator",o=[],i=window,c=i;c;){try{if(c.frames[n]){t=c;break}}catch(t){}if(c===i.top)break;c=i.parent}t||(function t(){var r=i.document,e=!!i.frames[n];if(!e)if(r.body){var o=r.createElement("iframe");o.style.cssText="display:none",o.name=n,r.body.appendChild(o)}else setTimeout(t,5);return!e}(),i.__tcfapi=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(!e.length)return o;"setGdprApplies"===e[0]?e.length>3&&2===parseInt(e[1],10)&&"boolean"==typeof e[3]&&(r=e[3],"function"==typeof e[2]&&e[2]("set",!0)):"ping"===e[0]?"function"==typeof e[2]&&e[2]({gdprApplies:r,cmpLoaded:!1,cmpStatus:"stub"}):o.push(e)},i.addEventListener("message",(function(t){var r="string"==typeof t.data,n={};if(r)try{n=JSON.parse(t.data)}catch(t){}else n=t.data;var o="object"===e(n)?n.__tcfapiCall:null;o&&window.__tcfapi(o.command,o.version,(function(e,n){var i={__tcfapiReturn:{returnValue:e,success:n,callId:o.callId}};t&&t.source&&t.source.postMessage&&t.source.postMessage(r?JSON.stringify(i):i,"*")}),o.parameter)}),!1))}}))()}();
</script>
The code must be installed in the top of the site page head
section, before any ads codes and libraries.
We recommend installing the stub code on the site if you are using non-Clickio 3rd party monetization solutions. For directly installed plain Google ads tags please refer to this article.
The code is a subject to change, please be sure to have the latest version installed on the site prior to filing support requests in case of any issues.
After installing this code on the page, you can then call the API as usual (getTCData
dump example is shown below).
window.__tcfapi('getTCData', null, function (consentData, consentDataSuccess) {
console.groupCollapsed('getTCData called ('+consentDataSuccess+')');
console.log(consentData);
console.groupEnd();
});
The stub stores the request and replies as soon as the full code loads. PostMessage commands are also supported.