Skip to main content

Configure preemptive blocking manually

--

Configuration

If you have opted for the integration of the banner via HTML code, you can also configure the preventive blocking in this way. To do this you need to modify the attributes of all the suppliers' <script> and <iframe> by following these steps:

  • Add the data-managed="as-oil" attribute to uniquely identify scripts managed by Avacy

  • Change the value of the type attribute to as-oil so as not to launch the script as it does not recognize its type. This will be converted with the content of data-type once cookies are accepted from the banner.

  • Add the data-type attribute indicating the original type of the script/iframe, in order to maintain the actual type of the script that will subsequently be executed until the Cookie Policy is accepted

  • Add the data-purposes attribute whose value is a string containing the numerical identifiers of the IAB purposes (found here) that must be checked so that the script can run correctly. If this field is omitted, all intents must be enabled to initialize the item.

  • If the script is in a separate Javascript file, also add the data-src attribute and enter the path to the .js file.

  • Add a data-custom-vendor attribute with the alphanumeric identifier of the vendor. If the vendor appears under *IAB Third Parties, change the attribute name to data-iab-vendor.

Following the previous points you will have a code similar to this:

<script data-managed="as-oil"
        data-type="text/javascript"
        data-src="path/to/the/script.js"
        data-purposes="1,2,4"
        data-custom-vendor="d116"
        type="as-oil">
  document.getElementById("demoText").innerHTML  =  "This text will be shown with given consent!";
</script>

In this case, we are specifying that the script will be executed only after accepting cookies or, alternatively, after ticking the supplier with id d116 (under Publisher's third parties) and the purposes with id 1, 2 and 4 from the cookie preferences panel under IAB Purpose.

Testing

In the example case, to verify the correct functioning of the script block, we open the page in question and, without opting in via the banner, we verify that the text “This text will be shown with given consent!”.

Navigate in the cookie banner preferences panel and tick the necessary purposes, in this case the first, second and fourth under the IAB Purposes item, then navigate to the Publisher's third parties item and tick the supplier with id d116 (which is always Facebook).

Finally click on Save and Continue and check that the writing actually appears on the screen.

If the flow ran successfully, you have successfully configured preemptive blocking for the script in question.