Salesforce

Preventing Auto-Blocking from Blocking Scripts

« Go Back
Information
Preventing Auto-Blocking from Blocking Scripts
UUID-71e7d0a8-03d8-e272-e683-72cadded2ecf
Article Content

You can add a parameter to the scripts on your website to prevent Auto-Blocking from blocking the script. This will ensure that the script is never blocked regardless of the categorization.

Normal Auto-Blocking Behavior

The following code is representative of normal Auto-Blocking behavior with examplescript.com/javascript.js and Cookie Category C0004. In it's current state, this snippet example would block any cookie assigned to cookie category C0004.

<script src="cookielaw.org/Tenant-GUID/AutoBlock.js"></script>

<script type="text/plain" src="examplescript.com/javascript.js" class="optanon-category-C0004"></script>
 

Preventing Auto-Blocking of Scripts

To prevent Auto-Blocking from blocking the script, you will need to add the argument data-ot-ignore to the script segment. This will make Auto-Blocking ignore the script and it will continue to load.

<script src="cookielaw.org/Tenant-GUID/AutoBlock.js"></script>

<script data-ot-ignore src="examplescript.com/javascript.js"></script>
 

Prevent Auto-Blocking of Google Tag Manager

Auto-Blocking is capable of blocking Google Tag Manager. If this occurs, use one of the follow methods to unblock Google Tag Manager:

j.setAttributeNode(d.createAttribute('data-ot-ignore'));
j.setAttribute('class','optanon-category-C0001');

Example:

<!-- Google Tag Manager -->
<script>(function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.setAttributeNode(d.createAttribute('data-ot-ignore'));
j.async = true;j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-XXXXXXX');
</script>

OneTrust Autoblocking Configuration Overview Video

 
 
 
Article Visibility
51,242
Translation
English
Checked

Powered by