Connecting WooCommerce to Segment
WooCommerce keeps the order in your own database, which is both the advantage and the reason nobody has wired it properly. Segment is a customer data platform rather than an ad network, so sending to it is not about matching a conversion — it is about putting one clean event where every other destination can read it. The join between them succeeds or fails on one thing: whether the userId and anonymousId reaches the WooCommerce order before the conversion happens, because Segment can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
WooCommerce through Segment: Order Completed from the PHP hook
Fire Order Completed from woocommerce_payment_complete with Segment's PHP library or HTTP API, including order_id, revenue, currency, coupon and products. Use the WordPress user ID, or the anonymousId saved as order meta for guests. Pass stored click identifiers and consent state as properties, use the order number as messageId, and send Order Refunded.
Segment suits a WooCommerce store that sends the same orders to several ad platforms, email and a warehouse. Fire Order Completed from woocommerce_payment_complete using Segment's server-side library for PHP or its HTTP API, with order_id, revenue, currency, coupon and a products array built from the order's line items. Doing it in PHP means caching plugins and script optimization never stand between the order and the event.
The userId is the WordPress user ID for logged-in customers. For guests, save the analytics.js anonymousId into order meta at checkout and send the event with it, so the browsing and the purchase stay one person. Carry the click identifiers stored as order meta, and the consent state from the store's consent plugin, as properties; Segment destinations forward what they are given and will not check a WordPress cookie banner.
Use the order number as messageId so a payment hook firing twice produces one event across every destination. Send refunds from woocommerce_order_refunded as Order Refunded, which is part of Segment's ecommerce spec, and confirm which downstream destinations do something sensible with it.
WooCommerce → Segment · what breaks
Why this join usually fails — WooCommerce → Segment
- 01
The userId and anonymousId never reaches WooCommerce
WooCommerce sites are usually the most heavily plugged-in of any platform. Caching plugins serve a static page to the visitor, optimization plugins defer or strip scripts, and consent plugins block them entirely. Any of the three will stop an identifier being captured, and they fail silently.
- 02
Caching and optimization plugins eat the tracking
The page the customer sees is not the page your code assumed. This is the most common cause of WooCommerce tracking that worked at launch and silently stopped after a plugin update.
- 03
One bad event multiplied across every destination
Segment's value is fan-out, which is also its risk. An inconsistent identity or a duplicated event does not break one report — it breaks every connected tool simultaneously, and tracing it back is harder than debugging a direct integration.
- 04
Nothing reconciles afterwards
Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.
WooCommerce → Segment · the fix
What working looks like — WooCommerce → Segment
The userId and anonymousId on every order
Conversions arriving in Segment
Events land in Segment and forward to every connected destination, warehouse included, on one shared definition.
Reconciled against the source
WooCommerce → Segment · architecture
How WooCommerce and Segment actually connect
- 1
WooCommerce holds the truth
You own the database, so the truth is exactly as good as the query you write against it. Pin the status set first — whether processing, completed, or both count as a conversion changes the number by a lot and is the source of most arguments.
- 2
Segment needs a click to match
Segment needs a consistent identity model — the same userId everywhere, an alias when an anonymous visitor becomes known, and event names that follow one spec. Feeding it inconsistent identities pushes the mess to every connected destination at once.
- 3
The identifier is the bridge
The userId and anonymousId, captured at the visit and carried into the WooCommerce order.
- 4
The event source decides reliability
Fire server-side from the PHP hook rather than from the thank-you page template. Page caching means the thank-you page cannot be relied on to execute anything, and on many stores it is served from cache to a paying customer.
- 5
Deduplication at the destination
Segment deduplicates on messageId within a window. Because it fans out to many destinations, a duplicate here becomes a duplicate everywhere, which makes idempotent messageIds more important than in any single-destination integration.
WooCommerce → Segment · normal or broken
Working vs. broken, side by side — WooCommerce → Segment
Normal, not a fault
The userId and anonymousId present on the order
Sent from the woocommerce_payment_complete hook
Deduplicated correctly
Segment deduplicates on messageId within a window. Because it fans out to many destinations, a duplicate here becomes a duplicate everywhere, which makes idempotent messageIds more important than in any single-destination integration.
Reconciles with the source
Actually broken
The userId and anonymousId missing on most records
WooCommerce sites are usually the most heavily plugged-in of any platform. Caching plugins serve a static page to the visitor, optimization plugins defer or strip scripts, and consent plugins block them entirely. Any of the three will stop an identifier being captured, and they fail silently.
Sent from the browser
The page the customer sees is not the page your code assumed. This is the most common cause of WooCommerce tracking that worked at launch and silently stopped after a plugin update.
Counted twice, or not at all
Segment's value is fan-out, which is also its risk. An inconsistent identity or a duplicated event does not break one report — it breaks every connected tool simultaneously, and tracing it back is harder than debugging a direct integration.
Nobody has reconciled it
WooCommerce → Segment · diagnose
Diagnostic order — WooCommerce → Segment
- 01
Count orders carrying the userId and anonymousId
- 02
Follow one real conversion end to end
- 03
Check order meta on ten recent orders
Directly in the database or with a meta viewer. Then disable page caching for the checkout path and see whether coverage changes — if it does, caching is your cause.
- 04
Check identity resolution before checking anything downstream
If anonymousId is never aliased to userId, every destination sees two people where there is one, and no downstream fix helps.
- 05
Read the match rate, not the success message
Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.
WooCommerce → Segment · prove
How it gets proven — WooCommerce → Segment
Source of truth
WooCommerce → Orders (or the wp_wc_order_stats table), for the same window and status set.
- The userId and anonymousId confirmed present on a live order.
- An anonymous session confirmed aliased to a known user, with the event visible in at least one downstream destination.
- Order meta confirmed present on orders placed while full page caching was active.
WooCommerce → Segment · free audit
What we check in the free audit
- Count orders carrying the userId and anonymousId
- Follow one real conversion end to end
- Check order meta on ten recent orders
- Check identity resolution before checking anything downstream
- Read the match rate, not the success message
Checked against
WooCommerce → Orders (or the wp_wc_order_stats table), for the same window and status set.
Free30 minutesNo obligation
WooCommerce → Segment · when not to buy
When you don't need this — WooCommerce → Segment
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the userId and anonymousId.
- If you run a small store with no caching layer and a single free plugin already reporting accurately, leave it alone.
- If you send to one or two destinations, Segment is infrastructure you do not need — direct integrations are simpler and cheaper. It earns its place at genuine fan-out.
WooCommerce → Segment · what we deliver
What gets built — WooCommerce → Segment
Identifier capture into WooCommerce
Capture the click identifier and persist it as order meta on the order object with a small snippet in the theme's functions or a purpose-built plugin. Order meta lives in your own database, so it survives caching, plugin conflicts and the customer's browser.
Event source: the woocommerce_payment_complete hook
Fire server-side from the PHP hook rather than from the thank-you page template. Page caching means the thank-you page cannot be relied on to execute anything, and on many stores it is served from cache to a paying customer.
Dispatch to Segment
Server-side track and identify calls with a stable messageId, consistent userId, and the click identifier carried as a trait or property.
Reversals where they exist
The refund hooks carry the order ID, so reversals are straightforward once the identifier is on the order.
Written guarantee
95%+ tracking accuracy
Measured against WooCommerce → Orders (or the wp_wc_order_stats table), for the same window and status set.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
WooCommerce → Segment questions, answered
Call Segment's tracking API from woocommerce_payment_complete with an Order Completed event, the order number as messageId, and the user or anonymous ID saved on the order.
The analytics.js anonymousId captured at checkout and stored as order meta, so the purchase joins the visitor's browsing.
Almost always because the userId and anonymousId never reached the WooCommerce order. WooCommerce sites are usually the most heavily plugged-in of any platform. Caching plugins serve a static page to the visitor, optimization plugins defer or strip scripts, and consent plugins block them entirely. Any of the three will stop an identifier being captured, and they fail silently. Measure coverage before debugging the dispatch.
Segment identifies people by anonymousId before they are known and userId afterwards, and the alias between them is what stitches a session to a customer. Click identifiers travel as event properties or traits rather than as a matching key — Segment does not match anything itself, it forwards. That distinction changes the whole design: get the identity resolution right and every downstream destination inherits it.
The woocommerce_payment_complete hook. Fire server-side from the PHP hook rather than from the thank-you page template. Page caching means the thank-you page cannot be relied on to execute anything, and on many stores it is served from cache to a paying customer.
Segment's debugger shows events arriving and which destinations accepted them. Arriving is not the test — check a destination you care about and confirm the event landed there with the identity intact, then reconcile against your own records.
More on WooCommerce → Segment
- WooCommerce Subscriptions → SegmentConnecting WooCommerce Subscriptions to Segment
- WooCommerce → HubSpotConnecting WooCommerce to HubSpot
- WooCommerce → TikTokConnecting WooCommerce to TikTok Events API
RELATED GUIDES
Where WooCommerce → Segment fits in the rest of your tracking
- Shopify → SegmentConnecting Shopify to Segment
- OpenCart → SegmentConnecting OpenCart to Segment
- Swell → SegmentConnecting Swell to Segment
- WooCommerce → BigQueryConnecting WooCommerce to BigQuery
- Furniture ecommerceConversion tracking for furniture ecommerce, measured after delivery
- EDD → SegmentConnecting Easy Digital Downloads to Segment
- BigCommerce → SegmentConnecting BigCommerce to Segment
- Checkout Extensibility → SegmentConnecting Shopify Checkout Extensibility to Segment
Free · 30 min
Get WooCommerce and Segment joined properly
Free30 minutesNo obligation
