WooCommerce Consent Mode v2

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.

Design your banner free

Facts checked · Sources

Set it up in 6 steps

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
html · WPCode header, top
<!-- 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 featureWhat it addsConsent behaviour
GTM4WP (Google Tag Manager for WordPress)The GTM container plus WooCommerce GA4 ecommerce events in the data layerOptional Consent Mode v2 'default' command with flags you choose
Google Analytics for WooCommerceGA4 tracking with ecommerce eventsNo banner of its own; integrated with the WP Consent API; EEA and UK visitors must grant consent before analytics runs
Google for WooCommerceGoogle Ads and Merchant Center taggingDocuments Consent Mode and recommends a consent tool
WooCommerce Order Attributionsbjs_ cookies (sbjs_session, sbjs_current, sbjs_first …) that record where an order came from; on by default since 8.5Compatible with the WP Consent API; otherwise tracking is on
Site Kit by GoogleAnalytics and Ads tagsDetects 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.

Complianz alternative: free options and switch guide

Comparing cookie banner tools?

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.

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.

Compare plans
  • FreeAvailable now

    €0forever

    • 1 domain, 5,000 pageviews a month
    • Consent Mode v2, 6 languages, consent log
    Design your banner free
  • 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.