Info
Content

How to block third-party codes & cookies if no consent is given?

The CMP can postpone the load of ads on your website until consent is given. In order to enable this feature you need to change existing creative codes on your website.

Please note, that blocking / postponed loading only works with asynchronous script codes and Iframe codes.

Iframe-Codes

If you want to postpone an iframe code, please follow these steps:

  1. Change the src="…" attribute of the iframe to data-cmp-src="…"
  2. Add a new src="about:blank" attribute to the iframe
  3. If a class="…" exists, add cmplazyload to the value. If class does not exist, add the attribute including the value class="cmplazyload"
  4. (optional but recommended) Add a new attribut data-cmp-vendor="x" and/or data-cmp-purpose="x" in order to fire the code only if consent for this vendor and purpose is given. See info below.

Example code before change:

<iframe width="300" height="250" noresize="noresize" scrolling="no" 
        frameborder="0" marginheight="0" marginwidth="0"
        src="http://adserver.de/?x=1&y=2"
        ALLOWTRANSPARENCY="true"></iframe>

Example code after change:

<iframe width="300" height="250" noresize="noresize" scrolling="no"        
        frameborder="0" marginheight="0" marginwidth="0"        
        class="cmplazyload"        
        src="about:blank"        
        data-cmp-src="http://adserver.de/?x=1&y=2"        
        ALLOWTRANSPARENCY="true"></iframe>

asynchronous Script-Codes

If you want to postpone the load of an async. Script code, please follow these steps:

  1. If a src="..." exists, change the src="…" attribute of the script to data-cmp-src="…"
  2. If a type="..." exists, change its value to text/plain, otherwise add the attribute with this value type="text/plain".
  3. If a class="…" exists, add cmplazyload to the value. If class does not exist, add the attribute including the value class="cmplazyload"
  4. (optional but recommended) Add a new attribut data-cmp-vendor="x" and/or data-cmp-purpose="x" in order to fire the code only if consent for this vendor and purpose is given. See info below.

Example code 1 before change:

<ins class="asm_async_creative" style="display:inline-block; width:300px; height:250px; text-align:left;" 
     data-asm-host="ads.adspirit.net" data-asm-params="pid=395&wmid=525&nvc=1"></ins>
<script src="https://ads.adspirit.net/adasync.min.js" async type="text/javascript"></script>

Example code 1 after change:

<ins class="asm_async_creative" style="display:inline-block; width:300px; height:250px; text-align:left;" 
     data-asm-host="ads.adspirit.net" data-asm-params="pid=395&wmid=525&nvc=1"></ins>
<script class="cmplazyload" data-cmp-src="https://ads.adspirit.net/adasync.min.js" async type="text/plain"></script>

Example code 2 before change:

<script type="text/javascript">
  console.log("do something here");
</script>

Example code 2 after change:

<script type="text/plain" class="cmplazyload">
  console.log("do something here");
</script>

Additional attributes

The following additional attributes can be added to script/iframe codes in order to further align the delivery to certain consent results:

Attribut

Description

data-cmp-hide="1"

if present, CMP will hide the iframe if consent is not given and unhide the iframe if consent is given

data-cmp-vendor="xxx"

CMP will only activate this script/iframe if consent for vendor xxx is given. Multiple vendors can be combined using comma, e.g. data-cmp-vendor="xxx,yyy,zzz"

data-cmp-purpose="xxx"

CMP will only activate this script/iframe if consent for purpose xxx is given. Multiple purposes can be combined using comma, e.g. data-cmp-purpose="xxx,yyy,zzz"

Note: If data-cmp-vendor="..." and data-cmp-purpose="..." are not present, the system will check if at least 1 purpose was accepted. If that is the case, the code will be activated.

You can find the IDs of all purposes in menu Purposes:

You can find the IDs of all vendors in menu Vendors/Whitelist:

 

Back to top