99Trace

Install and set up 99Trace

From the zip to the first order in PostHog: install, connect your project, test, choose consent and switch it on. If PostHog already runs on your shop, switch without splitting your visitors.

On this page
  1. Set up in 7 steps
  2. Test order
  3. Switch from another setup
  4. Staging copies
  5. Update and uninstall

How do I install and set up 99Trace?Link to this section

Upload the plugin, connect your PostHog project, place a test order in Test mode, choose your consent setting, then run PostHog in the browser and set the mode to On. If PostHog already runs on your site, do steps 6 and 7 as Switch from another PostHog setup describes, so your visitors keep their PostHog ID.

  1. 01

    Check what you needLink to this section

    • WordPress 6.5+, WooCommerce 8.7+ and PHP 8.0+.
    • A PostHog project on PostHog Cloud (EU or US) or self-hosted. PostHog has a free tier. The project API key starts with phc_.
    • WordPress's scheduled tasks (WP-Cron) running: 99Trace sends orders in the background. Tools → Site Health warns when scheduled events run late.
  2. 02

    Install the pluginLink to this section

    Download the zip from the latest release ↗ (opens in a new tab). In WordPress, open Plugins → Add New Plugin → Upload Plugin, choose the zip, then click Install Now and Activate Plugin. 99Trace starts with the mode Off and sends nothing.

  3. 03

    Connect your PostHog projectLink to this section

    Open WooCommerce → 99Trace (also under WooCommerce → Settings → 99Trace). On the Connect tab, paste the project API key and set the PostHog host to your project's region. Leave Run PostHog in the browser off for now. The top of the tab then names the host and the project key 99Trace sends to.

  4. 04

    Place a test order in Test modeLink to this section

    Set the mode to Test and follow the test order. Nothing reaches PostHog in Test mode.

  5. 05

    On the Consent tab, choose the option that matches your cookie banner, or Track every visitor if your shop asks for no consent. Which consent setting to choose compares them.

  6. 06

    Run PostHog in the browserLink to this section

    Remove any other PostHog snippet, plugin or Google Tag Manager tag first (how). Then tick Run PostHog in the browser, save, and clear your page cache. Leave the Browser features on PostHog's setting to control them from your PostHog project.

    Without this step, 99Trace sends only its server events: orders, refunds, carts and checkouts. Page views, funnels from product page to purchase, session replay and experiments need PostHog in the browser.

  7. 07

    Switch it onLink to this section

    Set the mode to On and save. Each paid order reaches PostHog after the wait before sending (10 minutes by default), timestamped at the payment. Check the first real order as in the first order with the mode On.

How do I place a test order and find it in PostHog?Link to this section

Place one order in Test mode and read it in the WooCommerce log. After you set the mode to On, check the first real order in three places: PostHog's Activity, the buyer's person in PostHog, and the order's PostHog box in WooCommerce.

In Test modeLink to this section

  1. Set the mode to Test and save. To see the browser's events in the browser console as well, tick Debug logging.
  2. Open the shop in a private window where you are not signed in. 99Trace records no shop staff.
  3. Add a product to the cart and pay with a method that marks the order paid without a real charge, such as your payment provider's test mode or cash on delivery. A bank transfer stays on hold and sends no purchase until you mark it paid.
  4. Wait for the wait before sending, 10 minutes by default.
  5. Open WooCommerce → Status → Logs and choose the log with the source 99trace. Each event is a line that starts with TEST MODE, not sent. Expect Product Added, Checkout Started and one Order Completed with the order total as revenue.

Test orders stay unsent An order paid in Test mode is marked as logged and never sent, also after you switch to On. On a live shop, a test order also sends its e-mails and reduces stock.

The first order with the mode OnLink to this section

About ten minutes after the payment, check the order here:

WhereWhat you should see
PostHog → Activity (+)One Order Completed for the order, with the order total as revenue, the payment time as its time, and $lib 99trace.
The person behind that eventThe page views from before checkout, Product Added, Checkout Started and Order Completed on one person, and Order Confirmation Viewed from the thank-you page. With Customer details on the person on, the buyer's e-mail, name and phone are on the person.
WooCommerce → Orders → the order → PostHog (99Trace)The identity saved at checkout, and each event's state: pending while it waits, then sent with the time and the event ID. Each refund gets its own line.
WooCommerce → Status → 99TraceThe last 30 days' paid web orders, counted by delivery state, identity, consent and payment method.
A WooCommerce order screen with the PostHog (99Trace) box: identity browser, the distinct ID, visitor anonymous, the session, consent not_required, the capture time, and Order Completed and a refund, each sent with its time and event ID.
The PostHog (99Trace) box on an order. Identity browser: PostHog in the browser handed the visitor's identity to the checkout.

The box's Identity line says how the order was linked: browser (handed over by PostHog in the browser), cookie (read from PostHog's cookie), shop_cookie (the shared visitor ID, for example while PostHog was blocked) or customer_account (the signed-in customer). not linked with a reason means the order joined no visitor, usually because the buyer gave no consent.

Then refund the test order in WooCommerce: Order Refunded reaches the same person. A test order on the live shop counts in PostHog and in every destination fed from it, such as Meta or Google Ads, so note its order number to exclude it.

How do I switch to 99Trace from another PostHog setup?Link to this section

Keep the same PostHog project key and swap in one sitting: set 99Trace up with the mode Off, remove the old PostHog, switch on 99Trace's PostHog in the browser, set the mode to On and clear the page cache. 99Trace's PostHog reads the cookie your old setup wrote, ph_<project key>_posthog, so returning visitors keep their PostHog ID. Purchases paid before the switch are never sent, so past revenue is not counted twice.

We tested the hand-over: a visitor first recorded by another PostHog plugin kept the same visitor and device ID after the switch, and a visitor that plugin had identified stayed identified.

Before you switchLink to this section

  • Use the same project key. Another key sends to another project, where every visitor starts new.
  • List what reads the old events. Insights, funnels, cohorts and destinations built on the old setup's event names need updating, or rename 99Trace's events to the old names under Events. 99Trace never identifies a buyer by e-mail address, so anything that waits for an e-mail-based $identify needs another trigger.
  • Check where the old setup kept the visitor. PostHog keeps it in its cookie by default, and 99Trace continues it. A setup that ran PostHog in memory only, or cookieless, had no ID to keep.

The stepsLink to this section

  1. 01

    Set up 99Trace with the mode Off

    Follow steps 1 to 5 of the setup with the old setup's project key. Test mode works while the old setup still runs: 99Trace logs its server events and sends nothing.

  2. 02

    Remove the old PostHog

    The snippet, the plugin or the Google Tag Manager tag: what to remove is below.

  3. 03

    Switch 99Trace on

    Tick Run PostHog in the browser, set the mode to On and save.

  4. 04

    Clear the page cache

    Clear the page cache and any CDN cache, then open a cached page and check that its source loads 99trace.js and none of the old PostHog code. A visit during the swap can cache an old page again; if it did, clear the cache once more.

  5. 05

    Check that visitors were not split

    Run the five checks below on the same day.

Do steps 2 to 4 within a few minutes. The shop then never runs two copies of PostHog, and the gap without one lasts only that long.

What to removeLink to this section

The PostHog snippet

Delete it from the theme (header.php or functions.php) or from the header-scripts plugin that adds it, such as WPCode. 99Trace can't detect a snippet. When the snippet's PostHog starts before 99Trace's, 99Trace keeps its own PostHog off on that page; with Debug logging, the browser console says so.

Another PostHog plugin

Deactivate it. 99Trace detects another plugin only when "posthog" is in its plugin folder or file name. While one is active, 99Trace runs no PostHog in the browser, shows a notice naming it, and still sends its server events. A plugin without "posthog" in its name goes unnoticed. Deactivating normally keeps the plugin's settings, so you can switch back.

A Google Tag Manager tag

Pause the tag that loads PostHog, or remove its trigger, and publish the container. 99Trace can't see tags. If Google Tag Manager also loads Cookiebot, choose Cookiebot under Consent: Automatic finds only the Cookiebot plugin.

Run 99Trace beside the old setup firstLink to this section

To compare before you swap, set the mode to On and leave Run PostHog in the browser off. 99Trace then sends only its server events (carts, checkouts, orders and refunds) under the visitor your old setup's PostHog cookie names. While both run:

  • PostHog receives two purchases per order when the old setup sends one too. 99Trace's carry $lib 99trace: count only one source in insights and destinations, or rename 99Trace's events under Events while you compare.
  • 99Trace reads the cookie of the project key under Connect. If the old setup sends to another project, enter that project's key in Read the visitor from key.
  • Cart and checkout events from visitors without a PostHog cookie, such as those whose browser blocks PostHog, are not sent until 99Trace runs PostHog in the browser.

Then swap with steps 2 to 5. Once 99Trace runs PostHog in the browser, it reads the visitor from its own project key and ignores Read the visitor from key.

How do I check that visitors were not split?Link to this section

CheckHowA split looks like
Returning visitors keep their IDBefore the switch, note the distinct_id in your browser's ph_<project key>_posthog cookie (developer tools → Application → Cookies). After the switch, reload the shop in the same browser.Another distinct_id in the same browser.
One page view per pageOpen one shop page while PostHog's Activity shows live $pageview events.Two $pageview events for one page, under two distinct IDs: two copies of PostHog still run.
Visitors per dayA trend of unique users per day across the switch.A jump at the switch time without more orders. A drop is expected if you now wait for consent where the old setup did not.
Purchases on browsing visitorsOpen the persons of a few Order Completed events after the switch, and the Identity counts under WooCommerce → Status → 99Trace.Purchases on persons without page views, beyond buyers who gave no consent.
The old setup is goneEvents that only the old setup sent, under its own event names.They still arrive: a cached page or a forgotten copy still runs it.

Switching back and forth If you return to the old setup and later switch to 99Trace again, 99Trace's hourly check sends the purchases of the last three days that it never sent, including those the old setup already reported. Before switching again, delete the option w99_phwc_sending_since (with WP-CLI: wp option delete w99_phwc_sending_since), so 99Trace counts from the new switch.

How do I keep a staging copy from sending?Link to this section

99Trace remembers the address sending was switched on for. A copy of the shop at another address, such as a staging site or a developer's machine, stops sending and shows a notice, so its test orders never reach your live project. On the live shop at a new address, an administrator clicks Send from this address.

To keep a copy in Test or Off whatever its settings say, add define( 'W99_TRACE_MODE', 'test' ); to the copy's wp-config.php, or give the copy the key of a test project.

How do I update or uninstall 99Trace?Link to this section

UpdateLink to this section

Upload the new zip under Plugins → Add New Plugin → Upload Plugin and choose Replace current with uploaded. Once the WordPress.org listing is approved, update from the dashboard.

UninstallLink to this section

Deleting the plugin removes its settings and scheduled tasks. The data saved on orders stays, so a reinstall never sends an order twice.

Coming from 99Hog for WooCommerce?Link to this section

99Trace is its new name. Activate 99Trace, deactivate 99Hog, then clear your page cache: settings, queued events and visitor IDs carry over, and 99Trace waits with a notice while 99Hog is still active. Server events then carry $lib 99trace instead of 99hog-woocommerce.

Next: privacy and consent →