Skip to main content
Auto Blocker implementation guide
Updated over a week ago

Follow the steps below to enable Auto Blocker for your Consent Banner.

Enable Auto Blocker

  1. Check the "Enable Auto Blocker" option on the "Embed Consent Banner" page in your Termly dashboard.

  2. Add the Consent Banner script before all other scripts in the <head> section of every page on your site.

It is critical that you load the Consent Banner before all other scripts so Auto Blocker can intercept them before a visitor has opted in or out. Failing to do this can result in your site not being compliant with GDPR and other international data regulations.

If your Consent Banner code snippet looks like the example below, you are using an older code snippet that does not include Auto Blocker. You will need to replace your code snippet with the new one found in your dashboard to get Auto Blocker functionality.

<script>  
    (function () {    
        var s = document.createElement('script');    
        s.type = 'text/javascript';    
        s.async = true;   
        s.src = 'https://app.termly.io/embed.min.js';    
        s.id = '123-456-789';    
        s.setAttribute("data-name", "termly-embed-banner");    
        var x = document.getElementsByTagName('script')[0];    
        x.parentNode.insertBefore(s, x);  
    })(); 
</script>

Auto Blocker Attribute

Auto Blocker is controlled within your Consent Banner code snippet under the data-auto-block attribute. A consent banner code snippet with Auto Blocker enabled looks like this:

<script  
    type="text/javascript" 
    src="https://app.termly.io/embed.min.js"  
    data-auto-block="on"  
    data-website-uuid="123-456-789"  >
</script>

A consent banner code snippet with Auto Blocker disabled looks like this:

<script  
     type="text/javascript" 
     src="https://app.termly.io/embed.min.js" 
     data-auto-block="off" 
     data-website-uuid="123-456-789" >
</script>

Learn more

Did this answer your question?