Combine the use of Google Tag Manager with automated cookie blocking by Cookiebot to get the best of both worlds. Implementation is quick and easy and allows you to:
- Control tags and cookies based on the user's consent, using triggers and Consent Mode in Google Tag Manager AND
- Let Cookiebot automatically control all other cookies not set by Google Tag Manager, based on the consent given, typically cookies set by third party scripts that are embedded directly in your website.
To achieve this, make sure that the Cookiebot script is not executed by Google Tag Manager. So either remove the Cookiebot CMP tag, pause it, or remove the "All Pages" trigger assigned to it.
- Ensure that the Google Tag Manager script is first to load on your website.
- Mark up your Google Tag Manager script tag with:
This will ensure that the Google Tag manager script won't unintentionally get blocked by the auto blocking feature.
- Insert the Cookiebot script with automatic cookie blocking immediately after Google Tag Manager script.
Here's an example of how this could look:
If you have renamed the dataLayer, you need to add the
data-layer-name attribute to the Cookiebot script tag, with the new dataLayer name as its value.
For tags that support built-in consent checks, like Google Ads Conversion Tracking and Remarketing, Floodlight, Google Analytics and Conversion Linker, we recommend using Google Consent Mode, which can be activated by inserting the following snippet right before the Google Tag Manager script in your header:
Furthermore, if you have renamed the dataLayer, ensure that you replace
window.dataLayer with the actual name of the dataLayer.
= window.gtmDataLayer || ;
For all other cookie-setting tags in Google Tag Manager, implement Additional Consent Checks as described in our GTM deployment guide.
You may also implement the use of Google Tag Manager with manual blocking and implementation of prior consent for any remaining elements outside your tag manager. Use the script for manual cookie blocking and follow our guide here for setting up Google Tag Manager implementation