We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

GDPR Cookie popup issue

  • #3228
    Avatar photo[anonymous]

    Hello Publii team!

    I am looking into Publii as a CMS of choice for our new website. Everything works well enough, except for the GDPR Cookie popup. I have the latest version of the used Theme (customised heavily) but I cannot seem to get the cookie to disable.

    I have a custom <script> inside the custom HTML section, where Google Analytics is called. I read through the documentation and am not sure where to place the {{ gdprScriptBlocker }}. Also I am confused by when you state to “catalogue and separate” scripts into groups, how would do that? The link on your site pointing to the Disqus.hbs implementation of this is giving back a 404 error, and I have been unable to find an answer on the forums.

    Warmest regards

    Avatar photoBob

    I think all needed info can be found in our docs

    Avatar photo[anonymous]

    Hi Ben,

    I have tried to follow the docs, but could not get the cookie disabled which led me to my post. Let me try explain a bit better

    Inside Custom HTML => Head:  I have the Google Analytics script

    <script async src=""></script>
    <script `type="{{ gdprScriptBlocker "analytical"}}"`> //Google analytics code here </script>

    Within my index.hbs file I am including {{{ publiiFooter }}} before the closing </body> tag of the page to allow for GDPR cookie handling.

    When I inspect the site, the Google Analytics cookie is still present regardless of whether the proper checkbox is selected or not.

    Hope this explains it a bit better.

    Avatar photoBob

    Helpers do not work via Custom HTML code, you have to edit the source theme files ‎⁨(Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME)

    To preserve the custom code changed from being overwritten the next time your theme is updated, please make sure you have created override files, which are essentially copies of the existing theme files and are stored separately →

    Avatar photo[anonymous]

    Hi Bob,

    Thank you! That works like a charm now. Just one more question, once you choose to disable a cookie script again (after enabling it) the cookie remains shown within the Dev Tools (Chrome, Firefox).  Is this expected behaviour, or does Publii handle deleting the cookie as well?

    Once again thank you so much for the advice!

    Avatar photoBob


    Did you delete all cookies before testing?

    Avatar photo[anonymous]

    Hi Bob,

    Yes I did. I cleared out my entire cache and deleted cookies.

    I ran the site with the cookie disabled – no cookie showing in the dev console.

    I selected the cookie to enable it, hit save – cookie appeared in dev console as expected.

    I unchecked the cookie to disable it again, hit save – cookie remains inside the dev console on reload.

    However when I manually deleted the cookie it did not re-appear unless enabled again, so it might just be a hanging around but not actually running.