UniConsent Tag Implementation

JavaScript tag Installation

Each of your websites has a unique javascript tag to be installed on every page.

You can find the UniConsent tag at the Install & Setup section.

There are two parts of the tags. The first part is a stub that should be embedded at the top of your page. The second part can be loaded with async. There is a minimum performance impact on your site.

Stub code

You can also choose to load the stub code with the following javascript tag:

Copied
<script src="https://cmp.uniconsent.com/v2/stub.min.js"></script>

You can also replace the following code with the above stub tag:

Copied
<script type="text/javascript">
!function(){var i,r,o;i="__tcfapiLocator",r=[],(o=window.frames[i])||(function e(){var t=window.document,a=!!o;if(!a)if(t.body){var n=t.createElement("iframe");n.style.cssText="display:none",n.name=i,t.body.appendChild(n)}else setTimeout(e,5);return!a}(),window.__tcfapi=function(){for(var e,t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];if(!t.length)return r;if("setGdprApplies"===t[0])3<t.length&&2===parseInt(t[1],10)&&"boolean"==typeof t[3]&&(e=t[3],"function"==typeof t[2]&&t[2]("set",!0));else if("ping"===t[0]){var n={gdprApplies:e,cmpLoaded:!1,cmpStatus:"stubCMP",apiVersion:2};"function"==typeof t[2]&&t[2](n,!0)}else r.push(t)},window.addEventListener("message",function(n){var i="string"==typeof n.data,e={};try{e=i?JSON.parse(n.data):n.data}catch(e){}var r=e.__tcfapiCall;r&&window.__tcfapi(r.command,r.version,function(e,t){var a={__tcfapiReturn:{returnValue:e,success:t,callId:r.callId}};i&&(a=JSON.stringify(a)),n.source.postMessage(a,"*")},r.parameter)},!1))}();
!function(){var i,n,s;i="__uspapiLocator",n=[],(s=window.frames[i])||(function a(){var e=window.document,n=!!s;if(!s)if(e.body){var t=e.createElement("iframe");t.style.cssText="display:none",t.name=i,e.body.appendChild(t)}else setTimeout(a,5);return!n}(),window.__uspapi=function(){for(var a=[],e=0;e<arguments.length;e++)a[e]=arguments[e];if(!a.length)return n;"ping"===a[0]?"function"==typeof a[2]&&a[2]({cmpLoaded:!1,cmpStatus:"stubCMP"},!0):n.push(a)},window.addEventListener("message",function(t){var i="string"==typeof t.data,a={};try{a=i?JSON.parse(t.data):t.data}catch(a){}var s=a.__uspapiCall;s&&window.__uspapi(s.command,s.version,function(a,e){var n={__uspapiReturn:{returnValue:a,success:e,callId:s.callId}};i&&(n=JSON.stringify(n)),t.source.postMessage(n,"*")},s.parameter)},!1))}();
</script>

You can disable 'privacy badge' and add the following link on your page.

Copied
<a href="#" onclick='__tcfapi("openunic");return false;'>Consent Settings</a>

You can target a DIV on your web pages with CSS selector, UniConsent automatically insert the Consent Settings Link within the DIV based on GEO location and your enabled features.

Copied
<div id="uniconsent-config"></div>

You can put the following place holder DIV at footer of your web pages, UniConsent automatically insert the Consent Settings Link within the place holder based on GEO location and your enabled features.

Copied
<div id="uniconsent-config"></div>

Install with WordPress and Drupal plugin:

You can find the license key at the Install & Setup section.

Next

If you like to integrate your javascript tags, please go to Thrid party Javascript Tags Integration section.