/ /

Console Logging Blocked Items

Updated last month

If you would like to see what has been blocked on a particular page of your site, you can do so by adding the following event listeners and console logging immediately after loading the Osano CMP.

window.Osano.cm.addEventListener("osano-cm-cookie-blocked", function (item) {  
          console.log("Cookie blocked: " + item);  
});
window.Osano.cm.addEventListener("osano-cm-script-blocked", function (item) {  
          console.log("Script blocked: " + item);  
});
window.Osano.cm.addEventListener("osano-cm-iframe-blocked", function (item) {  
          console.log("iFrame blocked: " + item);  
});

Once the CMP has initialized, the console will log all scripts, cookies, and iFrames that have been blocked on that particular page.

Code Example:

<script src="https://cmp.osano.com/<customerId>/<configId>/osano.js"></script>  
<script>  
    window.Osano.cm.addEventListener("osano-cm-script-blocked", function (item) {  
        console.log("Script blocked: " + item);  
    });  
    window.Osano.cm.addEventListener("osano-cm-cookie-blocked", function (item) {  
        console.log("Cookie blocked: " + item);  
    });  
    window.Osano.cm.addEventListener("osano-cm-iframe-blocked", function (item) {  
        console.log("iFrame blocked: " + item);  
});
</script>
Was this article helpful?
Subscribe to receive updates on this article