Guide

TikTok Events API for WooCommerce

Chris Gaudy 17 min read
tiktok events api woocommerce tiktok pixel tiktok server side tracking ttclid tiktok event match quality tiktok deduplication woocommerce conversion tracking

Your TikTok campaign spent €2,000 this week. WooCommerce shows 61 paid orders. TikTok Ads Manager reports 23 Purchases, and half of those carry an Event Match Quality score you would rather not look at. The campaign is not underperforming - the reporting is. TikTok’s algorithm is optimizing against a third of your actual conversions, and every day it retrains on that partial picture it gets more confident about the wrong thing.

The fix is the TikTok Events API: a server-to-server channel that sends conversions straight from your WooCommerce server to TikTok, bypassing the browser entirely. This guide covers what the API actually expects on the wire, the deduplication rules that decide whether running it alongside the pixel doubles your numbers or fixes them, the match keys that drive Event Match Quality, and the specific WooCommerce hooks that make the difference between capturing a paid order and hoping the customer comes back to your thank-you page.

What the TikTok Events API Actually Is

The TikTok Events API is a server-side interface for sharing marketing events with TikTok. Instead of a JavaScript pixel in the visitor’s browser reporting “this person bought something,” your server makes an authenticated HTTPS request that says the same thing. TikTok’s own guidance is not to choose between the two: it recommends running the pixel and the Events API together, with deduplication, because each covers what the other misses.

Concretely, web events are POSTed to the v1.3 endpoint:

POST https://business-api.tiktok.com/open_api/v1.3/event/track/
Access-Token: <your access token>
Content-Type: application/json

The access token is generated in TikTok Events Manager against the pixel you want to feed (Assets → Events → your pixel → settings). It authenticates your ad account, so it belongs in server-side configuration and nowhere near your theme files or a public JavaScript bundle.

The body identifies the source and carries a batch of events:

{
  "event_source": "web",
  "event_source_id": "YOUR_PIXEL_ID",
  "data": [
    {
      "event": "Purchase",
      "event_id": "6e534bf3-424f-5839-b2aa-6b79b0aa817c",
      "event_time": 1757318400,
      "user": { },
      "page": { },
      "properties": { }
    }
  ]
}

Three things in that skeleton trip people up repeatedly:

  • event_source_id is your pixel ID. Events API events are not a separate asset from your pixel - they land on the same pixel, delivered through a different door. This is why deduplication is not optional.
  • event_time is a Unix timestamp in seconds, not milliseconds. A millisecond timestamp is rejected, and a timestamp that runs ahead of TikTok’s clock is worse: it is accepted, and the conversion gets attributed to a moment that has not happened yet. (We clamp future-dated events to server time for exactly this reason - a buyer’s phone with a skewed clock once put a purchase 80 seconds into the future.)
  • data is an array. It takes a batch, which matters once your store has real volume: one request per order is workable, one request per event across a busy Black Friday is not.

The test_event_code field, when present, routes the event to the Test Events tab instead of production reporting. One warning here, because it is a genuinely expensive mistake: the code must be your code, copied from Events Manager → Test Events. An event carrying a test code TikTok does not recognise is discarded - it never appears in Test Events and it never counts as a conversion. A store that leaves a fabricated test code switched on loses every purchase silently.

Note also that this is Events API 2.0. If you are maintaining an older integration built on the 1.0 schema, field names differ (phone_number versus phone, for instance), and TikTok returns code: 0 - success - for a payload containing keys it does not recognise. A “working” integration that returns success while quietly dropping your phone match key is a very common failure state.

Why the Pixel Alone Under-Reports on WooCommerce

The generic reasons are familiar: ad blockers strip the pixel, Safari’s Intelligent Tracking Prevention caps JavaScript-set cookies at a fraction of their intended lifetime, and consent banners block the script for a meaningful share of EU traffic. Those apply to every platform.

TikTok on WooCommerce adds sharper edges.

The thank-you page is not a reliable event trigger. WooCommerce’s browser-side purchase pixel fires on the order-received page. Customers who pay through an off-site gateway - PayPal, Klarna, and most regional processors - are redirected away from your store and frequently never come back to that page. They paid; the pixel never ran. The mirror-image failure is just as common: a customer who refreshes, bookmarks, or shares the order-received page fires Purchase again, and one order becomes three.

Page builders and caching quietly remove it. Elementor, Bricks and Divi replace WooCommerce’s order-received template, so a pixel hooked into the default template never renders. A full-page cache (WP Rocket, LiteSpeed, W3 Total Cache) can serve a stored copy of a page whose tracking script has since changed, for days.

The Blocks migration broke the events pixels listened for. WooCommerce’s Cart and Checkout Blocks - the default for new stores since WooCommerce 8.3 - are built on the Store API and a JavaScript data store, not the legacy jQuery checkout events. Tracking that listens for added_to_cart simply stops receiving AddToCart and InitiateCheckout after the switch, often while Purchase keeps working, which makes the problem look like a TikTok issue rather than a WooCommerce one.

HPOS moved the order data. High-Performance Order Storage, the default since WooCommerce 8.2, moved orders out of WordPress posts and into dedicated tables. Tracking code reading order values with get_post_meta() gets empty strings - so events still fire, but with a value of 0.

And one that is specific to TikTok: your traffic arrives through TikTok’s in-app browser. A visitor who taps your ad inside the TikTok app lands in an embedded webview, not their default browser. Cookies set there do not always survive the trip to a later session in Safari or Chrome, which is precisely the window in which a considered purchase happens. A browser-only setup is betting your attribution on the shortest-lived storage in the stack.

Each of these is survivable alone. Stacked, they are why the numbers in your WooCommerce admin and the numbers in TikTok Ads Manager describe two different businesses.

The Payload TikTok Actually Wants

An Events API integration that “works” - returns code: 0, shows events in Events Manager - can still be worth very little if the user object is thin. This is the part that determines whether TikTok can connect your conversion to a real account, and it is where most implementations quietly leave value on the table.

The user object: what gets hashed and what does not

TikTok’s user schema is not uniform, and getting the two groups backwards is a silent, invisible failure - a field hashed when it should be plain is simply unmatchable, and nothing in the API response tells you. Here is the split AxiTrace sends for a WooCommerce purchase:

Field Format Notes
email SHA-256 Normalized to lowercase, trimmed, before hashing
phone SHA-256 Normalized to E.164 (+48787987794) first - the + is part of the hashed string
external_id SHA-256 Your own stable identifier for the visitor
first_name, last_name SHA-256 Lowercased, punctuation stripped, before hashing
zip_code SHA-256 Normalized before hashing
city, state, country Clear text Lowercased, not hashed
locale Clear text BCP-47, e.g. pl-PL
ip, user_agent Clear text Never hashed
ttclid Clear text TikTok click ID - see below
ttp Clear text TikTok first-party cookie value

Two rules follow from that table. First, normalize before you hash, always - Jan@Example.COM and jan@example.com produce completely different digests, and only one of them matches. Second, omit fields rather than sending them empty. An empty string is a value TikTok will try, and fail, to match; a missing key costs nothing.

Event Match Quality - TikTok’s 0-10 score per event, visible in Events Manager - is driven almost entirely by how many of these keys you send. A server-side Purchase carrying a hashed email, a hashed phone, an external_id, the ttclid, the IP and the user agent scores in a completely different band from a browser Purchase carrying a cookie and a user agent. And critically: the server is where those keys exist. The billing email and phone from a WooCommerce order live in your database, not in the browser’s JavaScript context. This is the single biggest reason the Events API outperforms the pixel on match quality, quite apart from ad blockers.

page and properties

page carries url and referrer. properties carries the commercial payload - value, currency, contents[] with content_id, content_type and quantity per line item, order_id. The catalog IDs in contents[] are what let TikTok connect a purchase to a product in your catalog, so a Purchase sent with a total value but no contents[] will report revenue while contributing nothing to catalog-driven optimization.

Deduplication: The Rule That Decides Whether This Helps or Hurts

Run the pixel and the Events API side by side without deduplication and every conversion is counted twice. TikTok’s rules are specific, and worth knowing exactly:

  • The key is the event name plus event_id. Both must match. You have to send the same event_id through both channels - TikTok cannot infer it.
  • Pixel-to-pixel and API-to-API duplicates are collapsed within a 48-hour window from the first event.
  • Pixel-to-API duplicates are collapsed when the second event arrives more than 5 minutes after, and within 48 hours of, the first.
  • TikTok keeps the first event it received for measurement and reporting.

Note how narrow the actual matching rule is: it is the event name and event_id pair, and nothing else. Timing, value, and user data play no part - two events that describe the same purchase down to the cent are two conversions if their event_ids differ, and the 48-hour window only limits how long TikTok keeps looking for a match. This is why “the pixel and the API both fired for the same order” is never, on its own, a reason to expect deduplication.

The practical consequence for WooCommerce: your event ID must be derived from the order, not generated at random. A random UUID in the browser and another random UUID on the server share nothing, and TikTok counts both. A deterministic ID - the same function of the same order ID, computed identically in the browser and on the server - matches every time, including on a retry, a replay, or a duplicate webhook.

Event names in 2026

TikTok renamed two standard events effective 1 May 2025:

  • CompletePayment → Purchase
  • SubmitForm → Lead

Legacy names still work and are auto-converted on TikTok’s backend, displaying under the new names in reporting, audiences and optimization. Separately, ClickButton and PlaceAnOrder are soft-deprecated: fully supported until 2027, but removed from the current documentation.

This matters more than a naming footnote. If your browser pixel sends CompletePayment and your server sends Purchase with the same event_id, TikTok’s auto-conversion lands them both on Purchase - and they deduplicate correctly. If you “modernize” only one leg and change the event_id at the same time, you have just created two conversions per order. Change one thing at a time.

ttclid and _ttp: The Attribution Keys WooCommerce Loses

Two identifiers do the attribution work, and a WooCommerce store loses both in ordinary operation.

ttclid is the click ID TikTok appends to your landing page URL when someone taps your ad. It is the strongest link between a click and a conversion - and it exists only in that first URL. Nothing captures it unless something reads it out of the query string and stores it. Then the shopper browses, adds to cart, leaves, comes back two days later from a bookmark, and buys. By then the ttclid is long gone from the URL, and if it was never persisted, the purchase you send to TikTok has no click to attach itself to.

_ttp is TikTok’s first-party browser cookie, set by the pixel. It is request-scoped data: it exists while the customer’s browser is talking to your server, and it is gone by the time an asynchronous background job dispatches the purchase event. If your integration reads cookies at send time rather than at checkout time, _ttp will be empty on every order.

The fix on WooCommerce is unglamorous but decisive: capture at request time, persist on the order, read back at send time. AxiTrace stores _ttp (along with _fbp, _fbc, the GA cookies, Reddit’s IDs, and its own visitor and session IDs) as order meta - written through WooCommerce’s CRUD, never update_post_meta(), so it survives HPOS - at every request-scoped hook available: the Store API order-processed hook, the classic checkout order-processed hook, and the payment-hook redirect return. Whichever one fires first for a given gateway, the identifiers are on the order.

ttclid takes a different route, because a single order-meta snapshot is the wrong shape for it. The AxiTrace web SDK reads ttclid out of the URL on the landing page and stores it in a first-party cookie with a 90-day staleness cap, then it becomes part of the visitor’s profile. When the purchase is forwarded days later, the server enriches the event with the first-touch ttclid from that profile - so the click that started the journey is still attached to the conversion that ended it, even though the shopper arrived at checkout from a bookmark with a clean URL.

What Building This Yourself on WooCommerce Actually Takes

Suppose you write it yourself. The checklist is longer than “POST to an endpoint”:

  1. Fire the purchase on a server-side order hook, not the thank-you page. woocommerce_payment_complete fires when the gateway confirms payment - whether or not the customer ever returns to your store - which solves the off-site-gateway problem and the failed-order false positives at once. Add woocommerce_order_status_processing and woocommerce_order_status_completed as fallbacks, plus woocommerce_store_api_checkout_order_processed for Blocks checkout.
  2. Generate a deterministic event ID per order and attach the identical value to the browser pixel fire and the server event, so TikTok’s 48-hour dedup collapses the pair.
  3. Capture _ttp and ttclid at request time and persist them where the deferred job can read them back - order meta for the cookie, a durable visitor profile for the click ID.
  4. Build the user object with the right hash-versus-clear split, normalizing email to lowercase and phone to E.164 before hashing, and omitting empty fields.
  5. Send it asynchronously, through Action Scheduler or an equivalent, so a slow TikTok response never adds latency to checkout.
  6. Be HPOS- and Blocks-safe: read orders through wc_get_order(), declare compatibility, integrate with the Store API event model.
  7. Respect consent at send time, via the WP Consent API, so compliance does not mean blindness.
  8. Handle failures visibly. TikTok returns code: 0 for success and a non-zero code with a message otherwise - and, as noted, code: 0 for unrecognised keys too. Without per-event logging you cannot tell a working integration from a silently degraded one.
  9. Do it again for every other platform. Meta CAPI, Google Ads and GA4 each want a different payload shape, a different dedup field, and different hashing.

The official TikTok for Business plugin for WooCommerce does cover the basic path - it installs the pixel and enables the Events API in one click, and it syncs your catalog. What it does not give you is control over any of the above: which hook the purchase fires on, which match keys ride along, what the event ID is derived from, or what happened to the event that never arrived. When a store’s numbers are 40% short, that is exactly the surface you need access to.

How AxiTrace Solves This by Design

The AxiTrace plugin for WooCommerce server-side tracking implements the entire chain above, and its TikTok path is built around the specific failure modes in this article (TikTok is one of the 9 destinations of the AxiTrace Conversion API):

  • Purchases fire on woocommerce_payment_complete, with the status fallbacks and the Store API hook for Blocks - so a paid order reaches TikTok Events API even when the customer never returns from PayPal, and a refreshed order-received page cannot inflate the count.
  • The event ID is a deterministic UUID v5 derived from the order ID - byte-identical in the WooCommerce plugin, the Go ingestion API and the event worker. The browser pixel bridge and the server event carry the same value, so TikTok’s dedup collapses them. Because it is deterministic, a replay or a duplicate webhook produces the same ID rather than a second conversion.
  • _ttp is captured at request time and persisted as order meta through the WooCommerce CRUD (HPOS-safe), and ttclid is enriched server-side from the visitor’s first-touch profile - with a 90-day cap so a stale click ID is dropped rather than misattributing a purchase.
  • The user object is built correctly: email lowercased then SHA-256, phone resolved to E.164 from the order’s country then SHA-256, external_id from the visitor ID, name and ZIP hashed, city/state/country/locale in clear text - the split that TikTok’s Event Match Quality score actually rewards. PII is hashed before it leaves the process; the plain values never reach TikTok, and neither the values nor the digests are written to the integration log.
  • Event names track TikTok’s 2026 standard. Purchases send Purchase with the canonical event ID, plus a secondary PlaceAnOrder under a derived ID for funnel continuity until its 2027 sunset - derived precisely so it can never collide with the Purchase leg’s dedup key.
  • AddToCart is sent server-side from woocommerce_add_to_cart, so mid-funnel signal survives the Cart/Checkout Blocks migration that kills jQuery-event pixels.
  • Everything dispatches through Action Scheduler, so checkout latency is untouched even when the network is slow.
  • Every event is logged individually - what was sent, what TikTok answered, how long it took - so you can see a failing connection instead of inferring it from a monthly revenue gap. Test mode refuses to send unless you have configured your real test event code, rather than silently discarding your purchases.
  • Optionally, events travel through your own first-party tracking domain (metrics.yourstore.com), which is materially harder for a content blocker to recognise than a third-party endpoint.

And because the same event fans out from one place, connecting TikTok does not mean building this again for Facebook CAPI, Google Ads conversion tracking and GA4 - one plugin, one workspace key, correct dedup field and hashing per platform.

Getting Started

  1. Install AxiTrace for WooCommerce (requires WooCommerce 8.2+ and PHP 8.1+; HPOS and Cart/Checkout Blocks supported) and paste your workspace public key into the settings.
  2. Connect TikTok in the AxiTrace dashboard: your pixel ID and an Events API access token from Events Manager.
  3. Keep your TikTok pixel installed. This is a browser-plus-server setup, not a replacement - the pixel keeps the fast browser signal, the server guarantees the conversion arrives.
  4. Place a real test order through an off-site gateway in test mode. Confirm one Purchase - not two - in TikTok Events Manager, and check the Event Match Quality score on it.
  5. Reconcile after a week: WooCommerce orders versus TikTok Purchases. Closing that gap is the whole point.

The free plan covers 10,000 visits per month, which is enough to prove the reconciliation before you pay for anything. If you want the broader argument first, start with Why Server-Side Tracking Matters, and for the WooCommerce failure modes in depth, WooCommerce Conversion Tracking.

Frequently Asked Questions

Do I need to remove the TikTok pixel if I use the Events API?

No - and you should not. TikTok explicitly recommends running both together with deduplication. The pixel captures browser-only signal like page views and on-site behaviour with low latency; the Events API guarantees the conversion arrives even when the browser cannot report it, and carries the match keys (hashed email, phone, external_id) that only your server has. Deduplication is what makes the pair safe: send the same event_id from both channels and TikTok records the first one it receives.

Why does TikTok show fewer purchases than my WooCommerce orders?

Most often because the Purchase event is tied to the browser on the order-received page. Customers paying through off-site gateways frequently never return to that page, ad blockers and consent banners suppress the script for another slice, and TikTok’s in-app browser is a short-lived storage environment. Recording the purchase server-side at woocommerce_payment_complete captures the order regardless of whether the customer comes back or the pixel runs.

Why did my TikTok conversions double after enabling the Events API?

Because the browser and server events are not sharing an event_id, so TikTok treats them as two separate conversions. Deduplication keys on the event name plus event_id, and both channels must send the same value. If your browser leg sends a randomly generated ID, matching is impossible - the ID has to be derived deterministically from the order.

What is ttclid and why do I keep losing it?

ttclid is the click ID TikTok appends to your landing page URL when someone taps your ad, and it is the strongest signal linking a conversion back to a specific click. It only exists in that first URL. If nothing reads it out of the query string and persists it, a shopper who returns days later from a bookmark arrives with a clean URL, and the purchase you send has no click to attach to. AxiTrace persists it in a first-party cookie with a 90-day cap and enriches purchases from the visitor’s first-touch profile.

How do I improve my TikTok Event Match Quality score?

Send more identifiers per event, correctly formatted. The score is driven by how many match keys TikTok can use - hashed email, hashed phone, external_id, ttclid, _ttp, IP and user agent - not by anything in your campaign settings. Normalize before hashing (email lowercased, phone in E.164), omit empty fields rather than sending blank strings, and get the hash-versus-clear-text split right. Server-side events score higher structurally, because the billing email and phone exist in your WooCommerce database and not in the browser.

Does the Events API work if the customer refuses cookies?

Partly, and it should. The Events API is a delivery channel, not a consent bypass - if a visitor declines marketing consent, the event should not be sent, and AxiTrace checks the WP Consent API statistics and marketing categories before firing. What server-side tracking fixes is the consented traffic that a browser pixel loses anyway to ad blockers and browser privacy controls. Compliance and complete data are not in conflict; consent-blind tracking and compliance are.

Will server-side TikTok tracking slow down my checkout?

Not if it is asynchronous. AxiTrace dispatches every event through WooCommerce Action Scheduler, so the order is placed immediately and the outbound request runs in a background job. Checkout latency is unaffected even if TikTok’s API is briefly slow or unavailable - which is exactly the guarantee a synchronous in-request HTTP call cannot make.

Should I still use CompletePayment, or switch to Purchase?

Purchase is the current name - TikTok renamed CompletePayment to Purchase effective 1 May 2025 - and new implementations should use it. Existing pixels sending CompletePayment keep working; TikTok auto-converts legacy names on its backend and reports them under the new name. The one thing not to do is change the event name and the event ID in the same deployment: they deduplicate on the pair, so changing both at once turns every order into two conversions.

Written by

Chris Gaudy

Founder & CEO

Building accurate conversion tracking for e-commerce teams.

Get tracking insights in your inbox

Tips on server-side tracking, conversion optimization, and product updates. Delivered weekly.

No spam. Unsubscribe anytime.