Cookiebot Auto-Blocking Implementation for GTM + GTM4WP
Issue This Resolves
Fed up with cookiebot scans coming back to say consent is not fully active across your site from things like embedded YouTube videos?
Me too!
“Blocked until accepted by user: No”
“Prior consent fully enabled: no”
But I can only block scripts from GTM
These scripts are coming from YouTube and I can’t control them from GTM
I’m using gtm4wp and cookiebot doesn’t seem to like that
The explanation provided by cookiebot is linked below but the gtmwp plugin on WordPress was causing a headache.
Easy Steps to Follow
Install the cookiebot for WP plugin and connect it to your cookiebot account
Modify some of the settings as needed to let this plugin manage placing the GTM snippet so that GTM is not blocked by auto-blocking feature
Modify the gtm4wp plugin settings so that it does not insert the GTM snippet again (as the cookiebot plugin is now doing this)
Pause the Cookiebot CMP Tag Template in GTM as this is no longer required (as the auto blocking settings of the cookiebot plugin is now doing this)
Install and Modify the Settings in the Cookiebot for WP Plugin
We want this plugin to take over from dropping the GTM snippet (which is currently done by GTM4WP).
1.1 Within General Settings, connect the plugin your cookiebot account and make sure cookie-blocking is set to automatic
1.2 Move along the the Google Tag Manager section and paste in your GTM container ID
1.3 In the Google Consent Mode Section, enable the features as they are in the Cookiebot CMP Tag Template that is currently in GTM
2. Modify the gtm4wp plugin settings
I was using some very useful dataLayer integrations provided from GTM4WP which I rely on so removing GTM4WP was not a realistic option. Changing the settings shown below removes the GTM code but retains the dataLayer integration. Once complete I could see that the dataLayer events from GTM Preview mode were being sent a bit later than previously but I was not using any critical ecommerce settings so it was not an issue. (I do not know if this would be an issue for ecom sites or not).
2.1 Go to the GTM4WP plugin settings and turn off the container code (eeek!)
2.2 In the Integration Tab enable the checkbox for Cookiebot auto blocking
This adds the:
data-cookieconsent="ignore"
data attribute to any scripts coming from GTM4WP. This confused me greatly as the help link goes to GTM related article. What took a while to realise is that it also adds this attribute to any of the other integrations e.g. Contact Form 7 or WooCommerce.
2.3 In the same Integration tab, make sure the Google Consent Mode is not enabled from this setting
3. Pause the Cookiebot CMP Tag Template in GTM
Publish the container and save all the other plugin settings. Eek!
Final Result (from Cookiebot)
Well, in one sense, it is a massive let down!
The next scan results will be sent in an email and it will contain… no information about anything.
But the detailed report confirms all scripts auto-block until consent is given. Phew.
How Does This Look in the HTML?
Something like the screen grabs shown below…
some time lower down in the <head>
Useful Links
Remove Cookiebot Branding from your banner
cookiebot resource: Google Tag Manager and Automatic cookie blocking
cookiebot resource: Automatic cookie blocking