Passing the Consent String to a vendor

The IAB TCF specification is designed in a way so that vendors can automatically fetch the consent information from the CMP using the IAB TCF JS API. In case a vendor can not fetch the string (e.g. because only an <img> is implemented and not a <script> or <iframe>) you can use the following example script to fetch the relevant data:

  var tcstring = "";
  __tcfapi('getTCData',2, function (x,s){
    if("tcString" in x)
      tcstring = x.tcString;
  document.write('<scr'+'ipt src="' + tcstring +'&gdpr=1"></sc'+'ript>');


Back to top