Skip to main content

NextJS/CookieBot: CookieBot script with data-blockingmode=“auto” is preventing the dynamically generated scripts to load



  • Ahlem


    I'm having the same issue with my NextJS website, and it's driving me nuts. I'm not sure either about how turning it manual would affect the efficiency of Cookiebot, so I haven't tried that.

    Did you manage to figure out a way around it, Danyal?

    Any news, Cookiebot team?

    Thank you :)

  • Danyal

    Hi Ahlem 

    yes reply from cookiebot

    Filipe Lourenco (Cookiebot Support)

    Mar 24, 2021, 9:45 GMT+1

    Dear Danyal,

    Thank you for your message.

    What you mention in the ticket seems that the issue is when you enable the automatic blocking, the reason for this happening is that when a script sets a cookie besides its intended purpose, the entire script will be blocked until consent is given. The same is true for external js-files. If the file contains code that sets cookies, the entire file will be prevented from loading. As a result, certain features might stop working.

    However, there are 4 things you can do to prevent the Cookie blocker from blocking scripts:

    1. Mark up a script that mustn't be blocked as "ignore". To do this, simply add the following attribute: data-cookieconsent="ignore"
    2. Go to the manager and categorize the cookie that goes with the now blocked script as "necessary".
    3. Revert to the "manual" Cookiebot script where you have to mark up tags to enable prior consent, which we will continue to support.

    Be aware though that by preventing scripts from being blocked that set cookies, you will likely be setting a cookie without the users consent! Also if you've not experienced issue before implementing the new Cookiebot script, you like hadn't marked scripts up for prior consent.


    Beside that if the mode change to manual , we need to manually set third-party scripts which firing with gtags as one of this groups:  cookie_consent_preferencescookie_consent_statisticscookie_consent_marketing,

    for more information refer to below doc,Save%22%20to%20create%20the%20tag.


    hope that helps 

  • Manuel Hernandiz

    Hi, we've been having the same problem here, but with our sliders: Cookibot seems to block them, only on firefox, until cookies are accepted, then if the page gets refreshed they work.
    The console error we get is 'Jquery is not defined', therefore cookiebot is preventing the Jquery to load.

    It is not a issue of the implementation, as we are using the plugin. We have also tried to put the data-cookieconsent="ignore" tag on the Jquery script, but nothing seems to work. 
    Any idea how to solve this problem? Seems to work fine on Chrome.


Please sign in to leave a comment.