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.
  • Variations carry parent_* fields; products emit categories[], stock status, type, created_at, image, gallery.
  • Pricing decoupled from coupons — price / price_base are the buyer-visible regular / sale prices; coupons land in dedicated coupons[] arrays.
  • New filters: drswc_event_payload, drswc_product_payload, drswc_user_payload, drswc_consent_payload.

0.6

  • PII cache leak fix extended to cart/checkout pages (in addition to thankyou).
  • HPOS and Cart/Checkout Blocks compatibility declared.

0.5

  • Fixed PII leak on page-cached thankyou pages (LiteSpeed et al.) — identity now hydrated client-side from cookies.
  • Removed browser-side SHA256 hashing — DATA Reshape hashes server-side.
  • On-save tracking endpoint health check plus on-demand re-check button.
  • wp.org update-available pill in the settings header.
  • Loader URL tags the installed plugin version (&wp=).

0.4

  • Fresh-install checkbox defaults flipped to off.
  • Admin warning notice when the plugin is active but not configured.

0.3

  • AJAX add-to-cart detection works with third-party plugins (QuadLayers etc.) and themes whose buttons don’t expose data-product_id.
  • Removed the in-page dataLayer debug overlay.

0.1

  • Initial release.

Plugin Website
Visit website

Author
Eduard Doloc
Version:
0.9
Last Updated
May 28, 2026
Requires
WordPress 6.0
Tested Up To
WordPress 6.9.4
Requires PHP
7.4

Share Post

Join our newsletter.

Get insights into what’s happening at ChangelogWP right in your inbox. We don’t believe in spam.