Google Consent Mode v2 with Tag Manager on WooCommerce
Free scan: what loads on your site before consent?
Scan your shop's homepage and a product page: see which cookies and trackers start before anyone clicks. No sign-up.
Set the consent defaults before Google Tag Manager loads, let GTM's built-in consent checks handle Google tags, and hold every other tag until the visitor agrees. On WooCommerce, check two more things: plugins that set their own defaults (GTM4WP has a Consent Mode option), and WooCommerce's Order Attribution, which sets sbjs_ cookies and only waits for consent through the WP Consent API.
Facts checked · Sources
Set it up in 6 steps
- 1Put the consent defaults firstPaste the PrivacyPill snippet at the very top of the header with WPCode (Code Snippets → Header & Footer), above the Tag Manager container. Defaults are then set before any tag fires.
- 2Add Tag Manager with GTM4WPGTM4WP adds the container and pushes WooCommerce's GA4 ecommerce events (add_to_cart, purchase and more) to the data layer.
- 3Keep one consent defaultGTM4WP can fire its own Consent Mode v2 default. Leave that off and let PrivacyPill set it. If you keep it on, set every flag to denied so the two defaults can't disagree.
- 4Turn on consent checks in GTMAdmin → Container settings → enable the consent overview. Google tags read consent on their own; give Meta, TikTok and other tags 'Require additional consent', or fire them on the privacypill_consent event.
- 5Decide on Order AttributionWooCommerce → Settings → Advanced → Features → Order Attribution. It sets sbjs_ cookies and waits for consent only through the WP Consent API. The free PrivacyPill plugin shares each choice with that API; the hosted script doesn't — with the hosted script, switch Order Attribution off if you don't use its reports.
- 6Test a purchase pathIn Tag Assistant's Consent tab, On-page Default should be denied. Accept, add a product to the cart and check that add_to_cart fires with consent granted.
<!-- PrivacyPill: keep this first in <head>, before Google Tag Manager or analytics -->
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag('consent','default',{ad_storage:'denied',ad_user_data:'denied',ad_personalization:'denied',analytics_storage:'denied',functionality_storage:'denied',personalization_storage:'denied',security_storage:'granted',wait_for_update:500});</script>
<script src="https://privacy-pill-consent-studio.lovable.app/api/public/v1/pp.js?site=pp_your_site_key"></script>
<!-- Then the Google Tag Manager container (added by GTM4WP or your theme) -->Replace pp_your_site_key with your site key — you'll get it when you save your banner.
What each WooCommerce plugin does with consent
From each plugin's own documentation — check yours before you change settings.
| Plugin or feature | What it adds | Consent behaviour |
|---|---|---|
| GTM4WP (Google Tag Manager for WordPress) | The GTM container plus WooCommerce GA4 ecommerce events in the data layer | Optional Consent Mode v2 'default' command with flags you choose |
| Google Analytics for WooCommerce | GA4 tracking with ecommerce events | No banner of its own; integrated with the WP Consent API; EEA and UK visitors must grant consent before analytics runs |
| Google for WooCommerce | Google Ads and Merchant Center tagging | Documents Consent Mode and recommends a consent tool |
| WooCommerce Order Attribution | sbjs_ cookies (sbjs_session, sbjs_current, sbjs_first …) that record where an order came from; on by default since 8.5 | Compatible with the WP Consent API; otherwise tracking is on |
| Site Kit by Google | Analytics and Ads tags | Detects an existing Analytics tag and turns its own snippet off to avoid duplicates |
Checked 11 November 2026 — see Sources. Let one plugin own each Google tag: if GTM sends GA4, don't add it again through another plugin.
Why the order in <head> matters
Google's checklist asks for the default consent state before any tag fires. GTM's Consent Initialization trigger runs before every other trigger, but Google also warns that gtag() commands inside GTM Custom HTML aren't guaranteed to be ready before the next trigger. That's why the most reliable setup puts the consent snippet directly in the page, above the container.
Basic or advanced Consent Mode?
Basic mode keeps Google tags from loading until the visitor chooses. Advanced mode loads them right away and sends cookieless pings while consent is denied, which lets Google model conversions. PrivacyPill sets advanced-mode defaults (all denied, then an update on choice); if you want basic mode, block the Google tags themselves until consent in GTM.
Cart and session cookies
WooCommerce's own cookies — woocommerce_cart_hash, woocommerce_items_in_cart and wp_woocommerce_session_ — keep the cart and checkout working. European regulators' long-standing example of a cookie exempt from consent is exactly this: a shopping cart the visitor asked for. Keep them in the strictly necessary category.
Shop on Complianz Free?
Complianz puts Google Consent Mode v2 in Premium: in the free plugin the setting is switched off. So Complianz Free doesn't set Consent Mode signals for your Google Ads and GA4 tags itself — and Google needs them for ads measurement and remarketing with visitors in the EEA. Our Complianz comparison shows what Premium costs for your sites, the free alternatives that include Consent Mode v2, and a 15-minute switch that moves your GTM triggers from cmplz_event_ to privacypill_consent.
Comparing cookie banner tools?
- PrivacyPill vs. ComplianzWordPress or any website, free or a one-time price, Consent Mode v2 on every plan.Complianz alternative
- PrivacyPill vs. Borlabs CookieAny platform, and €49 once instead of €49 a year.Borlabs Cookie alternative
- PrivacyPill vs. CookiebotWhy people switch, six alternatives, a cost calculator and a 15-minute switch.Cookiebot alternative
- PrivacyPill vs. CookieYesUnlimited pageviews on Pro, no overage fees.CookieYes alternative
Frequently asked questions
Sources
Facts on this page come from these pages, read on . Spotted something out of date? Write to kalmwerk@gmail.com and we'll correct it.
- Google: verify your consent mode implementation
- Google: set up consent mode
- Tag Manager Help: consent settings and Consent Initialization
- Google Ads Help: basic vs. advanced consent mode
- GTM4WP on WordPress.org
- WooCommerce docs: Google Analytics for WooCommerce
- WooCommerce docs: Google for WooCommerce and consent mode
- WooCommerce docs: Order Attribution Tracking
- WooCommerce developer blog: Order Attribution on by default since 8.5
- WooCommerce docs: cookies WooCommerce uses
- Site Kit docs: managing the code Site Kit places
- Article 29 Working Party: Opinion 04/2012 on the cookie consent exemption
Using Google Ads or GA4? Check Consent Mode v2
See whether a consent default runs before your Google tags, what the four v2 signals start as, and how to fix it.
What PrivacyPill costs
The free plan works today. Pro and Lifetime open soon — join the waitlist and we'll email you once when they do.
FreeAvailable now
€0forever
- 1 domain, 5,000 pageviews a month
- Consent Mode v2, 6 languages, consent log
LifetimeOpens soon
€49once
- 1 domain, unlimited pageviews
- Every future update, no renewals
ProOpens soon
€9/month · or €79/year
- Unlimited domains and pageviews
- Monthly rescans, geo-targeting
Try it on your own site
Design your banner, preview it live, and paste one line. Free for one domain.