Google Tag Manager (GTM) is a powerful tool for managing website tags. When combined with CookieBeam, you can ensure all your tracking scripts respect user consent preferences through Google Consent Mode v2.
What is Consent Mode v2?
Consent Mode v2 is Google's framework for adjusting how Google tags behave based on user consent. It enables privacy-respecting measurement while maintaining compliance with regulations like GDPR.
Consent Mode Parameters
| Parameter | Category | Purpose |
|---|---|---|
| ad_storage | Marketing | Controls advertising cookies |
| analytics_storage | Analytics | Controls analytics cookies |
| ad_user_data | Marketing | Controls sending user data to Google |
| ad_personalization | Marketing | Controls personalized advertising |
| functionality_storage | Preferences | Controls functional cookies |
Integration Steps
Install CookieBeam via GTM
In GTM, create a new Custom HTML tag. Paste your CookieBeam script and set the trigger to "Consent Initialization - All Pages".
Configure Consent Mode Defaults
CookieBeam automatically sets default consent states to "denied" and updates them when users make choices. No additional configuration needed.
Update Your Google Tags
Ensure your GA4 and Google Ads tags are set to use Consent Mode. In the tag settings, enable "Require additional consent for ads features".
Test with GTM Preview Mode
Use GTM's Preview mode to verify consent states are being set correctly. Check the Consent tab to see the current consent status for each parameter.
Important
The CookieBeam tag must fire before any other tags that set cookies. Use the "Consent Initialization" trigger to ensure proper ordering.