WeePie Cookie Allow & GTM consent mode v2
Published: 11-10-2024updated: 11-10-2024
In this instruction we will do our best to explain you a basic example of how to implement Google Tag Manager (GTM) consent mode v2 with the WeePie Cookie Allow plugin. For this instruction we will add the Google Analytics (GA4) tag and test the Event Consent State (updated in the GTM dataLayer) before and after giving consent on our website.
WeePie Cookie Allow Plugin configuration
- Make sure you have version 3.4.8 (or higher) installed
- Go to the General plugin settings page section Google Tag Manager (GTM)
- Check the Enable field
- Check the Consent mode v2 field
This will make sure the WeePie Cookie Allow plugin will push Google consent mode v2 data to the
GTM DataLayer when users interact with the Plugin, e.g. accepting/declining cookies, saving the
cookie category settings or when resetting their consent.
Google Tag Manager configuration
- Go to Triggers in the left menu
- Click on New
- Give your new trigger any title you want
- Choose Custom Event under Trigger Configuration:
- In the Event name field enter: “wpca_consent_update”
- Choose to fire the trigger when the Event contains wpca_consent_update:
- Now go to the Tags menu
- Click on New
- Under Tag configuration choose Google Tag
- Give your new Tag any title you want:
- Then fill in your Google Analytics Measurement ID in the Tag ID field:
-> Read more on how to find your GA Measurement ID - Then go to Advanced Settings and make sure you have Once per event selected
- Next go to Consent settings > Additional Consent Checks and choose Require additional
consent for tag to fire, then fill in: analytics_storage: - Go the Triggering and choose the Trigger you have just created: wpca_consent_update:
- That’s it!
Test
You can now test if the GA4 tag (or your own tag) is blocked before consent and fired after consent.
Below we did a test on weepie-plugins.com. First without giving any consent:
You can see that the GA4 tag is NOT fired and the Current State value for analytics_storage is Denied.
Now when we are going to give consent for Analytical cookies in our WordPress website, we can see that the GA4 tag is fired:
And last, we can see that the WeePie Cookie Allow plugin updated the dataLayer for
analytics_storage. The Current State for analytics_storage now haves the value Granted: