Cookiesamtykke til WooCommerce-butikker
Hvad WooCommerce-add-on'en gør — auto-mapper 10+ tracking-scripts til samtykkekategorier, samtykkebevidst købstracking på tak-siden.
Udgivet
WooCommerce stores have more tracking scripts than the average WordPress site by a wide margin. Facebook for WooCommerce, Google Listings & Ads, Pinterest, TikTok, Klaviyo, Mailchimp — most stores accumulate 5-10 third-party marketing extensions over time, each one of which injects its own scripts and cookies. Wiring all of them to respect consent is the heaviest part of a WooCommerce CMP install.
The ConsentTrustee WooCommerce add-on handles this with auto-mapping — it knows about the common WooCommerce marketing extensions and applies the right consent categorisation automatically. This guide covers what gets auto-mapped, how purchase tracking works on the thank-you page, and the integration patterns for custom code.
What the add-on does
On top of the standard ConsentTrustee WordPress plugin, the WooCommerce add-on adds:
- Auto-mapping for 10+ common marketing extensions. Detects which ones are installed and wires their scripts into the right consent categories without manual configuration.
- Consent-aware purchase tracking. Conversion events on the thank-you page only fire if the visitor consented to Marketing/Statistics.
- Enhanced ecommerce data passing. Transaction data (order total, items, etc.) only sent to analytics if Statistics consent is granted.
- Checkout block compatibility. Works with both the legacy Checkout shortcode and the newer Checkout Block.
- WooCommerce-specific cookie categorisation. Pre-categorises WooCommerce's own cookies (cart, session, customer ID) into Necessary.
Install
- Install and activate the base ConsentTrustee WordPress plugin from Plugins → Add New.
- In the ConsentTrustee admin (Settings → ConsentTrustee), enable the WooCommerce add-on.
- Save settings. The add-on activates immediately — no separate plugin install needed.
- Visit a product page in incognito to verify the banner shows and the WooCommerce-specific cookies are categorised correctly.
Auto-mapped extensions
The add-on includes detection rules for these marketing/analytics extensions:
| Extension | Mapped category |
|---|---|
| Facebook for WooCommerce | Marketing |
| Google Listings & Ads | Marketing |
| Pinterest for WooCommerce | Marketing |
| TikTok for WooCommerce | Marketing |
| Snapchat for WooCommerce | Marketing |
| Klaviyo for WooCommerce | Marketing |
| Mailchimp for WooCommerce | Marketing (analytics piece) |
| Google Analytics Pro (MonsterInsights) | Statistics |
| WooCommerce Google Analytics Integration | Statistics |
| Hotjar | Statistics |
| Microsoft Clarity | Statistics |
If a visitor hasn't consented to Marketing, the Facebook Pixel won't fire even though the Facebook for WooCommerce extension thinks it should. The add-on intercepts the script injection and holds it back. After consent, the script is released.
Purchase tracking on the thank-you page
This is the part that most teams worry about. WooCommerce fires conversion events on the order-received page (the thank-you page after checkout) so your analytics platforms attribute the conversion to the right campaign. If those events fire regardless of consent, you're processing personal data (order details, customer email) without consent. If they only fire after consent, you lose attribution for visitors who reject.
The add-on handles this with three modes, configurable in the dashboard:
Mode 1: Strict. Conversion events only fire if the visitor consented to Marketing/Statistics. Visitors who rejected aren't attributed. Compliant, but you lose attribution for ~30–40% of conversions in EU markets.
Mode 2: Consent Mode v2 with cookieless ping. Even denied visitors send a cookieless ping with anonymous data. Google's conversion modeling fills in the gaps using BigQuery ML. You get most of the attribution back without storing personal identifiers. See GCM v2 for the detail.
Mode 3: Server-side fallback. For denied visitors, attribution flows server-side from the WordPress server directly to the analytics platform (GA4 Measurement Protocol, Meta Conversions API). Doesn't require client-side cookies. More complex to set up but most accurate.
Mode 2 is the default and the right choice for most stores. Mode 3 is for high-volume stores that need to squeeze every conversion attribution out of EU traffic.
WooCommerce's own cookies
WooCommerce sets several first-party cookies during normal operation. The add-on pre-categorises them so you don't have to:
woocommerce_cart_hash— Necessary (cart state)woocommerce_items_in_cart— Necessary (cart count)wp_woocommerce_session_*— Necessary (session)woocommerce_recently_viewed— Preferences (recently viewed widget)
These all qualify as “strictly necessary” under ePrivacy because they're required for the shopping experience the visitor explicitly chose (adding things to a cart). Only woocommerce_recently_viewed falls into Preferences because the recently-viewed feature is optional, not essential.
Custom code: integrating with the add-on
If you have custom tracking code in your theme's functions.php or a custom plugin, you can check consent state before firing:
// In a hook that fires on the thank-you page
add_action('woocommerce_thankyou', function($order_id) {
if (function_exists('ct_has_consent') && ct_has_consent('statistics')) {
$order = wc_get_order($order_id);
// Fire your custom analytics event here
}
});The ct_has_consent($category) helper checks whether the current visitor has consented to a given category. It returns false by default if no consent decision has been made — which is the safe default.
Subscription products and recurring billing
WooCommerce Subscriptions adds a few extra cookies for managing recurring billing state. The add-on auto-categorises these as Necessary because they're required for the subscription functionality the customer explicitly purchased.
What I'd read next
For the base WordPress install, Cookie Consent for WordPress. For the Google Consent Mode v2 details that power Mode 2, Google Consent Mode v2. And for the foundational compliance, GDPR Cookie Consent.