You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add E2E test coverage for Enhanced Conversions (ECEE) data flowing through the WooCommerce purchase event. WooCommerce is unique among the supported event providers because it extracts user data server-side from a WC_Order's billing details — including phone (E.164 normalization via WC_Countries) and a full address (street, city, region, postal code, country) — see WooCommerce.php::extract_user_data_from_order(). Because of this distinct code path, it warrants its own E2E coverage separate from the shared client-side form-plugin path.
"I don't really want to add e2e tests for each of these plugins […] We should generally have coverage in place for Plugin conversion tracking, the PII aspect is just a part of that, it doesn't warrant a whole separate suite of tests. […] each plugin we add into our flow will impact stability, so we should try to find a kind of middle ground."
To find that middle ground, the per-plugin ECEE E2E tickets (#11908, #12006, #12008, #12009, #12010, #12011) are consolidated into a single representative form-plugin ticket (see #12013), since those plugins all share the getUserData( fields ) utility in assets/js/event-providers/utils.js. WooCommerce is the only plugin with a meaningfully distinct ECEE data flow, so it keeps its own dedicated ticket — this one.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
E2E tests verify that on a completed WooCommerce checkout, the order's billing details (email, phone, name, and address) are sent to gtag as Enhanced Conversions user data on the purchase event, when all of the following are true:
The gtagUserData feature flag is enabled.
Plugin Conversion Tracking is enabled.
At least one of Ads / Analytics 4 / Tag Manager is connected.
E2E tests cover both guest checkout and logged-in user purchase scenarios.
E2E tests verify that no Enhanced Conversions user data is sent on the purchase event when:
Plugin Conversion Tracking is disabled.
The gtagUserData feature flag is disabled.
No GTag-using module (Ads, Analytics 4, Tag Manager) is connected.
E2E tests verify partial-data handling — only the billing fields actually present on the order are sent. Realistic scenarios to cover:
Orders without a billing phone (phone is optional by default in WooCommerce) produce no phone in the Enhanced Conversions data.
Orders for a country that does not use a state or postal code produce no region / postal_code in the Enhanced Conversions data.
Notes on test stability
WooCommerce must be installed for these tests to be meaningful — the integration cannot be exercised otherwise. To address Evan's concern about plugin-test fragility (similar to past AMP issues), consider:
Pinning a known-good WooCommerce version in CI.
Creating orders programmatically (via WC factory functions / WC_Order API or REST) rather than driving the WooCommerce checkout UI.
Asserting on the gtag payload (the integration boundary), not on WooCommerce's UI rendering.
Implementation Brief
In tests/playwright/specs/enhanced-conversions/woocommerce.spec.ts
Browser-only WooCommerce journey: shop -> add to cart -> checkout -> place order -> order received.
Test purchase payload from dataLayer event=purchase, assert event_source=site-kit and user_data contract.
Cover guest and logged-in purchase paths with deterministic checkout fixtures.
Cover gating conditions: conversion tracking disabled, gtagUserData disabled, and no connected GTag module.
Use resilient checkout execution for legacy Woo/WP matrix: option-based shop/checkout page resolution, deterministic add-to-cart path, and conditional purchase-event waits for scenarios where conversion scripts are expected to be absent.
Keep payload assertions aligned with Woo formatter behavior: lowercase names/address fields, E.164 phone normalization, optional region/postal omissions for non-required locales.
In tests/playwright/specs/enhanced-conversions/enhanced-conversions.spec.ts
Remove WooCommerce-specific helpers and cases from this file.
Feature Description
Add E2E test coverage for Enhanced Conversions (ECEE) data flowing through the WooCommerce purchase event. WooCommerce is unique among the supported event providers because it extracts user data server-side from a
WC_Order's billing details — including phone (E.164 normalization viaWC_Countries) and a full address (street, city, region, postal code, country) — seeWooCommerce.php::extract_user_data_from_order(). Because of this distinct code path, it warrants its own E2E coverage separate from the shared client-side form-plugin path.Why this exists / Background
Per Slack discussion with @aaemnnosttv:
To find that middle ground, the per-plugin ECEE E2E tickets (#11908, #12006, #12008, #12009, #12010, #12011) are consolidated into a single representative form-plugin ticket (see #12013), since those plugins all share the
getUserData( fields )utility inassets/js/event-providers/utils.js. WooCommerce is the only plugin with a meaningfully distinct ECEE data flow, so it keeps its own dedicated ticket — this one.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
gtagas Enhanced Conversions user data on thepurchaseevent, when all of the following are true:gtagUserDatafeature flag is enabled.purchaseevent when:gtagUserDatafeature flag is disabled.region/postal_codein the Enhanced Conversions data.Notes on test stability
WooCommerce must be installed for these tests to be meaningful — the integration cannot be exercised otherwise. To address Evan's concern about plugin-test fragility (similar to past AMP issues), consider:
WC_OrderAPI or REST) rather than driving the WooCommerce checkout UI.gtagpayload (the integration boundary), not on WooCommerce's UI rendering.Implementation Brief
tests/playwright/specs/enhanced-conversions/woocommerce.spec.tsevent=purchase, assertevent_source=site-kitanduser_datacontract.gtagUserDatadisabled, and no connected GTag module.tests/playwright/specs/enhanced-conversions/enhanced-conversions.spec.tstests/playwright/docker/wordpress/plugins/enhanced-conversions.phptests/playwright/bin/generate-backup-sql.shwoocommerce/sample-data/sample_products.xml.wordpress-importerfor XML import, then uninstall importer before backup export.US:CAdefault country and enabled BACS/COD settings).tests/playwright/docker/mariadb/backup.sqlafter script updates.tests/playwright/docker/wordpress/Dockerfiletests/playwright/docker-compose.ymlwpimage tag revision to Woo-enabled variant to avoid stale image collisions.tests/playwright/playwright.config.tstests/playwright/wordpress/database.tsandtests/playwright/wordpress/wordpress.tsgetOption,setOption) so WooCommerce E2E can toggle conversion tracking and resolve page IDs.tests/playwright/README.md${WP_VERSION}-v2).Test Coverage
QA Brief
Changelog entry