related articles: Plugins » GDPR Cookie Consent, Plugins » Analytics.md
GDPR Compliant Google Analytics on WordPresss
GTM4WP plugin and its main function
How GTM4WP fits into the GDPR compliance process, and how to properly set-up Google Tag Manager for WordPress (GTM4WP)?
To be compliant, we need to block the GTM container code until the user consents to it. As described by the author you will have to set the container placement option in plugin settings to “Off” and place the container code manually. More info here
Google Tag Manager ID is not even needed here. The proper basic configuration is explained here in GTM4WP Set-Up
To find out what is GTM snippet aka GTM container code, do read the following article: The Container Snippet
But besides the GTM container, one more entity is useful while setting up your tracking in GTM - the data layer.
How Real Cookie Banner works together with Google Tag Manager
If you are using Google Tag Manager (GTM), and I find it recommended, you must be aware of some facts.
Let’s be clear - if you don’t set Google Tag Manager properly by loading or unloading certain JS scripts, the GDPR plugin itself will not do anything. When GTM is in use, Real Cookie Banner only sends “events” to GTM and GTM should act on events accordingly, to include or exclude certain scripts.
Currently, in our setup, Cookie Consent functionality is, to say the least - not working at all!
- If you disable some service in GTM, it is still triggered on-site. Why? The idea is exactly the opposite - to control everything with GTM and not on-site
- When you disable GTM, it should not be loaded by GTM4WP plugin; avoid duplicate implementation of the gtag.js snippet
How to set up Google Tag Manager properly?
We have to configure GTM container to use all the triggers and variables and the easiest is to just import GTM For Wordpress (GTM4WP) Container into GTM.
Optional Consent Mode in GTM
Google has introduced Consent Mode to offer more flexibility when using GTM together with Cookie banners and consent management platforms. With Consent Mode you can get vital insights even when your users do not accept cookies. More info on Google Consent Mode and here
Efficiently use Google Tag Manager
How to manually add Google Tag Manager to WordPress- Yasen Lilov | Blog How to Load Google Analytics 10x Faster in WordPress