99Trace

How 99Trace works

Your shop's server sends each order to PostHog once, under the visitor saved at checkout, whichever browser the buyer finishes in. Here is each step, and what 99Trace does at the edges.

On this page
  1. From checkout to PostHog
  2. Which visitor
    1. One visitor ID
    2. Signed-in customers
  3. Another browser
  4. Sent once
  5. When orders arrive
    1. When PostHog is down
    2. Shop speed
  6. Other events
  7. Experiments
  8. Compatibility
  9. What is left out

How does an order get from checkout to PostHog?Link to this section

In four steps, from the first page view to the purchase in PostHog. The browser never sends the purchase: your shop's server does, when WooCommerce marks the order paid.

  1. 01

    One visitor IDLink to this section

    PostHog in the browser and the shop share one first-party visitor ID (cookie ph_wc_vid). Whichever side needs an ID first creates it, and the other uses it. So a cart event the server sends lands on the same person as the page views, also when an ad blocker stops PostHog in the browser.

  2. 02

    Identity saved at checkoutLink to this section

    When the buyer places the order, before any redirect to a payment page, 99Trace saves on the order:

    • the visitor's PostHog ID, session and device ID;
    • the consent state;
    • the feature flags (experiment variants) the visitor had;
    • where they came from: referrer, UTM parameters and ad click IDs.
  3. 03

    Purchase sent from the serverLink to this section

    When WooCommerce marks the order paid (often after the payment provider's webhook, with no browser involved), the server sends Order Completed under the saved identity, timestamped at the payment, in UTC, after the wait before sending.

  4. 04

    Sent onceLink to this section

    • The browser never sends the purchase, so a reload of the thank-you page sends nothing.
    • Each order event is built once, saved on the order, and sent with an ID derived from the shop, the event type and the order.
    • 99Trace resends only when it has no confirmation from PostHog, and a resend is byte-for-byte identical. PostHog treats events with the same ID, name, person and day as duplicates and removes the extra copy, usually within minutes (+).

How does 99Trace know which visitor placed an order?Link to this section

At checkout, before the buyer leaves for a payment page, 99Trace picks the buyer's PostHog identity and saves it on the order. It never changes after that: the purchase, and later a refund or a cancellation, all go to the same visitor. 99Trace takes the first of these that applies:

IdentityWhere it comes from
browserPostHog in the browser hands its visitor ID, session and experiment variants to the checkout.
cookieThe server reads PostHog's own cookie on the checkout request, for example on a checkout page that runs no 99Trace script.
customer_accountA signed-in customer without a PostHog identity, on a shop that tracks every visitor: the customer's anonymous account number.
shop_cookieThe visitor ID shared by the browser and the shop (cookie ph_wc_vid), for example when an ad blocker stopped PostHog in the browser.
not linkedNo visitor: the buyer refused or never answered the cookie banner, or no ID was found. The order is counted anonymously or not sent.

The order's PostHog (99Trace) box in WooCommerce shows which one was used, and for an order that is not linked, the reason, such as consent_denied or no_identity.

One visitor ID for the browser and the shopLink to this section

Cart, coupon, checkout and order events come from the shop's server; page views and clicks from PostHog in the browser. Both use one visitor ID, kept in a first-party cookie (ph_wc_vid). Whichever side needs an ID first creates it, and the other uses the same one. So an add to cart clicked before PostHog has loaded, or while an ad blocker stops PostHog, lands on the same person as the rest of the visit. When the server created an ID while PostHog in the browser already had another, 99Trace asks PostHog once to merge them.

The cookie is written only where the visitor may be recorded, and holds no personal data.

Signed-in customers on several devicesLink to this section

A customer who signs in is joined to one person in PostHog on every device they use, named by an anonymous account number (wc:<shop>:<user ID>), never by e-mail address or name. This needs analytics consent. After the customer signs out, the browser starts as a new visitor, so the next person on a shared computer is not added to the customer.

What happens when the buyer finishes in another browser?Link to this section

Buyers who pay in a bank app, or who start in Instagram's or Facebook's in-app browser, often come back to the thank-you page in another browser. That page's address carries the order key, which proves the browser may see the order, and 99Trace joins the browser to the buyer:

  • A browser with no PostHog history continues as the buyer's visitor, with nothing to merge.
  • A browser with its own anonymous history asks PostHog to merge the two.
  • A browser already identified as someone else, such as a signed-in account, is left as it is.

This works for guest orders, within 24 hours of the order, and needs PostHog running in the browser and Join the thank-you page's browser to the buyer on. The purchase itself never depends on it: it goes to the identity saved at checkout.

The same step links an order placed before the visitor answered the cookie banner, when they accept on its thank-you page before the order is sent.

How does 99Trace send each order only once?Link to this section

  • The browser never sends the purchase, so reloading or reopening the thank-you page sends nothing.
  • Each order event is built once, saved on the order, and sent with an ID made from the shop, the event type and the order.
  • 99Trace resends only when PostHog has not confirmed, and a resend is identical byte for byte. PostHog treats events with the same ID, name, person and day as duplicates and removes the extra copy, usually within minutes (+).
  • Purchases paid before 99Trace started sending to your project are never sent, so a switch from another setup doesn't count past orders again.
  • Deleting and reinstalling the plugin never sends an order twice: each order keeps its delivery state.

When does an order reach PostHog?Link to this section

99Trace holds each paid order for the wait before sending, 10 minutes by default and 0 to 120, then WordPress's scheduled tasks send it. The event keeps the time of payment, in UTC, so reports place it at the right moment however late it arrives.

The wait lets a one-click upsell accepted after payment join the purchase, and gives a buyer who accepts cookies on the thank-you page time to be linked.

When PostHog can't be reachedLink to this section

  • Order events: retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h. An hourly check also queues any order paid in the last 3 days that was never queued.
  • Cart, checkout and failed-payment events: retried for about two and a half hours.

Order events are therefore retried for about two days. Each retry sends the same event with the same ID, so nothing is counted twice.

Will it slow down my shop?Link to this section

Order events go out in the background through WooCommerce's Action Scheduler. On PHP-FPM or LiteSpeed hosting, cart and checkout events are sent after the page has reached the shopper. PostHog's script loads asynchronously, as PostHog's own snippet does.

What does 99Trace send besides purchases?Link to this section

EventSent when
Order RefundedA purchase PostHog received is refunded, fully or partly, with the refunded amount, on the buyer's person.
Order CancelledA paid order is cancelled later; its revenue is taken back.
Payment FailedA payment fails or is cancelled at the bank before the order is paid, with the attempt number.
Checkout StartedThe checkout opens with items in the cart, at most once per cart every 30 minutes.
Product Added, Product RemovedWooCommerce changes the cart: a button, a link, or a change on the cart or checkout page.
Coupon Applied, Coupon RemovedWooCommerce applies or removes a coupon, with its discount.

All of these come from the shop's server, so they arrive also when PostHog is blocked in the browser. Pages the browser loads in advance send their events only once the visitor sees them. The browser events, and every property of each event, are in the list of events.

Is 99Trace safe for A/B tests?Link to this section

Feature flags and experiments keep working in the browser, and the variants a buyer had at checkout are copied onto the purchase as checkout_flags, so you can check which variant each order came from.

Experiment metrics count only purchases linked to a visitor. Before you read a result, compare the share of linked purchases per variant. Behind a cookie banner, Load PostHog switched off lets an experiment show its variant before the visitor answers.

Which shops does 99Trace work with?Link to this section

  • WordPress 6.5+, WooCommerce 8.7+ and PHP 8.0+.
  • Block and classic checkouts, and WooCommerce's custom order tables (HPOS).
  • Custom checkouts such as FunnelKit. A checkout page that doesn't run 99Trace's browser script still gets the visitor from PostHog's cookie.
  • PostHog Cloud (EU or US) or a self-hosted PostHog.
  • Hosting where WordPress's scheduled tasks (WP-Cron) run: order events are sent through them.

What does 99Trace leave out?Link to this section

  • Shop staff, page editors and preview loads, by default (see Visitors & orders).
  • A copy of the shop at another address, such as a staging site, until an administrator confirms it.
  • Events of a page the browser loads in advance, until the visitor actually sees it.
  • Carts that a funnel checkout fills by itself, unless you choose otherwise under Events.

The full list of what 99Trace doesn't do is under limits.

Next: install and set up 99Trace →