Datalayer Tracking via DATA Reshape for WooCommerce
Changelog
0.9
Fix: Add-to-cart now tracks reliably on themes that hijack the single-product form with their own AJAX (Woodmart, custom builders, etc.). A new product-page click handler on the standard .single_add_to_cart_button fires the event before the theme’s submit logic runs, regardless of which AJAX library or endpoint the theme uses. Built-in 3-second JS dedup prevents double-fire when both this path and the legacy AJAX-listener path would trigger.
Fix: Listing add-to-cart with WooCommerce’s “Redirect to cart page after successful addition” option enabled — the ?add-to-cart= link redirected to the cart page before any client-side hook could fire, so the event was lost. A new server-side woocommerce_add_to_cart action hook now stashes the pending event in session so it emits on the cart page after the redirect.
Fix: Variable products on classic (non-AJAX) single-product pages now emit the chosen variation as products[0].id instead of the parent product id. The POST capture path was previously ignoring variation_id.
Internal: the new server-side hook is intentionally gated on non-AJAX, non-REST, non-admin contexts so AJAX flows (already covered client-side) don’t double-fire.
0.8
Consent integration overhauled. The legacy “Google Consent Mode granted by default” toggle (emitted a gtag(‘consent’, ‘update’, …) block) and the per-event envelope consent_default_grant toggle have both been removed. A single new “Grant consent by default” toggle now fires DATA Reshape’s native consent_updated push at session start — DATA Reshape detects most CMPs and Google Consent Mode v2 on its own, so this toggle defaults to OFF.
Tax fields (tax_included, tax_percent) are now omitted entirely from product, coupon, and shipping payloads when WooCommerce tax is disabled (previously emitted as tax_included: false).
Settings tabs renamed for clarity: “Browser events” → “Events”, “Server-side events” → “API Events”. The API Events tab is reserved for admin-recorded events (e.g. phone-call orders) and historical customer/order backfill — not a CAPI-style server-side mirror of browser events.
Settings also reachable under Marketing → DATA Reshape (shortcut to the canonical WooCommerce → Settings → DATA Reshape page).
Field labels simplified: “Server-side API endpoint” / “Server-side API key” → “API endpoint” / “API key”.
Internal: narrative inline comments moved to CLAUDE.md; no functional impact.
0.7
Hard cutover from window.dataLayer to DATA Reshape’s window.reshape API. Event names updated to the new spec (product_viewed, product_added_to_cart, cart_viewed, checkout_started, checkout_completed, etc.).
Mid-funnel checkout events on legacy checkout: billing_address_added, shipping_detail_added, payment_method_selected.
“Grant consent by default” and “Track checkout steps” toggles added.
Identity emission tightened — user object sent only when logged in or in checkout with confirmed contact data.