Implement Google Consent Mode v2 for GA4 in WooCommerce using GTM. Ensure GDPR/DMA compliance while preserving analytics and ad performance.
As privacy regulations like the GDPR and DMA continue to tighten, website owners must evolve to stay compliant. One of Google’s latest responses is Consent Mode v2, a framework that allows Google tags (e.g., GA4, Ads) to function based on a user’s consent choices. If you run a WooCommerce store and use Google Analytics 4 via GTM, implementing Consent Mode v2 is now critical—not only for legal compliance but also for maintaining meaningful analytics and ad performance.
✅ Why Consent Mode v2 Matters
Introduced in late 2023, Consent Mode v2 expands on the original Consent Mode by introducing two new consent signals:
These build on the original two:
If you're running Google Ads remarketing, enhanced conversions, or GA4, these four signals need to be configured based on user consent.
🧱 Key Components Required
Before we jump in, make sure you’ve got the following:
🛠️ Step-by-Step Implementation
1. Configure GTM for Consent Initialization
Consent Mode v2 needs to be initialized before any tracking fires. In GTM:
a. Create a New Tag: Consent Initialization
{
"ad_storage": "denied",
"analytics_storage": "denied",
"ad_user_data": "denied",
"ad_personalization": "denied"
}
This ensures no cookies are dropped until user preferences are recorded.
2. Connect Your CMP to GTM
Most modern CMPs offer native GTM integrations. Here's what to do:
a. Configure your CMP (example: Cookiebot)
Cookiebot, for example, pushes consent states to dataLayer like so:
window.dataLayer.push({
event: "cookie_consent_update",
analytics_storage: "granted",
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied"
});
b. Create Variables in GTM
Use Data Layer Variables to capture consent values:
3. Set Up Consent Triggers in GTM
Ensure GA4 and other marketing tags fire only when appropriate consent is granted.
Recommended by LinkedIn
a. Edit your GA4 Configuration Tag:
b. Optional: Configure Google Ads Tags Similarly
If you’re running remarketing or conversion tracking:
Require:
4. Validate the Consent Behavior
a. Use Google Tag Assistant
b. Chrome DevTools
c. Test CMP behavior
5. WooCommerce-Specific Considerations
In WooCommerce, user actions like Add to Cart, Checkout, and Purchase are often tracked as custom GA4 events. If you’re using GTM for this:
💡 Advanced Tip: Consent Mode with Server-Side GTM
If you're using Server-Side GTM, Consent Mode v2 is even more powerful:
📈 Final Thoughts
Implementing Consent Mode v2 in a WooCommerce store using GTM and GA4 is no longer optional—it’s essential. Done right, it allows you to maintain tracking fidelity while staying compliant with the latest data privacy laws.
By taking a granular, signal-based approach, you can align with legal requirements without completely sacrificing ad performance or analytics depth. Whether you're using Cookiebot, OneTrust, or another CMP, integrating it cleanly with GTM and WooCommerce ensures future-proof compliance and better trust with your users.
I’m passionate about empowering organizations with data-driven decision-making while respecting user privacy.
Here’s how you can connect with me or view my work:
Upwork Profile: Upwork
Freelancer Profile: Freelancer
My Blog on GTM & Website Analytics: Google Tag Manager Solution
If you or someone in your network is looking for an experienced professional in this space, I’d love to connect and chat further!
⚡GA4 | GTM | Google Ads | FB CAPI | Conversion Tracking Expert | Web Analytics Specialist 📊 Helping Businesses Maximize ROI with Accurate Tracking 🎯 Web Analytics | eCommerce | Tag Implementation | Data Strategy
1moMargub Alam shared insights on integrating GA4 with GTM for WooCommerce to enable advanced eCommerce tracking.