WARNING: Cookiebot script is included twice – please remove one instance to avoid unexpected results.

If you get this warning here is how to remove it.

Managing cookies and ensuring compliance with privacy regulations like GDPR can be complex. Cookiebot is a popular solution for obtaining user consent and managing cookies. When implementing Cookiebot on your website using Google Tag Manager (GTM), it's crucial to avoid script duplication to ensure smooth functionality.

If you had Cookiebot on your site before all the consent mode stuff and decided to install the community template, you must remove the script directly from your site or else you get this warning.

In this post, we’ll walk you through the process of using the Cookiebot community template in GTM and why you should remove the direct script implementation from your site.

Why Use Google Tag Manager for Cookiebot?

Google Tag Manager (GTM) simplifies the process of managing various scripts and tags on your website. By using GTM, you can:

  • Centralise script management
  • Easily update and deploy tags without modifying the site code
  • Ensure that scripts are fired correctly based on user consent
  • The easiest way to implement v2 of consent mode and send the signals to Google Ads.

Implementing Cookiebot Using GTM

Cookiebot provides a Community Template in GTM that makes the implementation straightforward. Here’s how to set it up:

  1. Obtain the Cookiebot CMP Tag Template:
  • In GTM, navigate to the Template Gallery and search for “Cookiebot CMP”.
  • Add the Cookiebot CMP tag template to your workspace.
  1. Configure the Tag:
  • Create a new tag in GTM.
  • Select “Cookiebot CMP” from the list of standard tag types.
  • Enter your Cookiebot Domain Group ID, which you can find in your Cookiebot account.
  1. Set the Trigger:
  • Choose “Consent initialization – All pages” as the trigger for the tag.
  • Name your tag appropriately (e.g., “Cookiebot Initialization”) and save it.

By following these steps, GTM will handle the inclusion of the Cookiebot script on your website.

Removing Direct Script Implementation

To avoid duplication and potential conflicts, it’s important to remove any direct implementation of the Cookiebot script from your site’s HTML or CMS configuration. Here’s why and how to do it:

Why Remove Direct Script Implementation?

  • Prevent Duplication: Having the script included multiple times can lead to unexpected behavior and errors.
  • Streamlined Management: Centralising script management through GTM makes it easier to maintain and update your tags.

How to Remove Direct Script Implementation

  1. Identify Existing Script:
  • Locate the Cookiebot script in your website’s HTML or CMS configuration. It typically looks like this:
    <script type=”text/javascript” charset=”UTF-8″ async=”” src=”https://consentcdn.cookiebot.com/consentconfig/9f242a70-3843-4ae6-314d-a53d02d86998/state.js”></script>
  1. Remove the Script:
  • Delete the script tag from your site’s code to prevent it from loading directly.
  1. Verify GTM Configuration:
  • Use GTM’s Preview mode to ensure that the Cookiebot CMP tag is firing correctly and that the consent banner is displayed as expected.
  1. Test Your Site:
  • After publishing your changes in GTM, thoroughly test your site. Make sure the consent banner works correctly and that cookies are managed according to user preferences.

Verification

To ensure everything is set up correctly, you can:

  • Inspect Page Source: Check your website’s source code to confirm that the Cookiebot script is only included once.
  • Use the Console: Use browsers console to see if the error appears still.

Conclusion

Using the Cookiebot Community Template in GTM simplifies the implementation process and does allthe consent mode V2 for you. By removing the direct script implementation from your site and managing it through GTM, you ensure a more streamlined and error-free setup.

Its quite annoying how on the instructions they don't tell you to remove the on site script. I've not had any issued due to Cookiebot being duplicated so far but I came across an issue where Google Ads and Analytics weren't matching up after a cookie update. This seems to be the only thing that was implemented wrong.


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *