The TikTok Events API is a server-to-server connection that sends marketing events from a website, app, CRM, tagging server or backend to TikTok. For web tracking, TikTok recommends running it next to the TikTok Pixel and deduplicating overlapping events. The Pixel captures browser context. The API gives the same conversion a server delivery path and can also take events created by a payment system or CRM.
That difference matters. Routing a browser event through a GTM server container protects the last hop to TikTok, but it can’t recover an event that never reached the container. A purchase created from a verified payment webhook starts on the backend, so it still reaches TikTok when the browser path fails.
I’ve watched that difference play out. On a Brazilian client’s server container that I monitor, a hashed email field silently broke the lookup that enriches webhook events, between 2026-09-09 and 2026-09-11. The webhook-originated TikTok Purchase count stayed level with the bank’s deposits the whole time, while GA4’s purchase coverage (GA4 purchases as a share of the bank’s daily deposits), which depended on the same lookup for its client ID, fell from 97% to 18% over three days. TikTok kept receiving the sales. What it lost, for buyers whose records were written after the change, was the stored ttclid and ttp the lookup should have attached, so those purchases went out with weaker match keys and nothing in the TikTok count showed it.
The Pixel sends from the browser; the Events API sends from a server
The Pixel and the Events API are complementary. The Pixel sees the page, click context and browser identifiers as they happen. The server forwards those signals with more control and can add customer details known only after a form or a payment. If both send the same event, TikTok needs to deduplicate them. If they send different events, such as AddToCart from the Pixel and Purchase only from a webhook, there’s nothing to deduplicate. Upstream loss is the limit: a browser event routed into sGTM still depends on the browser making the first request.
| Question | TikTok Pixel | TikTok Events API |
|---|---|---|
| Where does it send from? | Visitor’s browser | Tagging server, backend, app or CRM |
| What context does it see naturally? | Page, referrer, click, browser cookie | Only fields supplied by the source |
| Can the final TikTok call be blocked in the browser? | Yes | No, when it leaves from the server |
| Can it record a conversion the browser never sent? | No | Yes, if the source is a webhook, backend or CRM |
| Does it need deduplication? | Yes, when it overlaps with the API | Yes, when it overlaps with the Pixel |
The wider architecture is in the server-side tracking guide and the server-side GTM guide.
How the GTM server route works
The web container sends one stream to a first-party tagging subdomain. A server client claims the request and exposes its data to GTM variables, and a TikTok tag maps that data to a standard event such as Purchase and calls the Events API with the Pixel code and access token. That’s server-routed tracking, because the event started in the browser. A webhook or backend request sent into the same container is server-originated: it doesn’t depend on a thank-you page loading.
- The web container captures browser context, including
ttclidand the_ttpcookie when consent allows it. - The browser sends its event to your tagging subdomain, or the backend creates one from a webhook or CRM update.
- The server container maps the event, match keys, commercial parameters and consent state.
- The TikTok server tag sends the payload to the Events API.
The server container needs hosting. ATA’s server GTM containers are made for Stape-hosted infrastructure, with the tracking logic kept in GTM under your control.
Two setup paths: TikTok’s interactive flow or a template on an existing container
TikTok’s server-side GTM instructions offer an interactive setup in Events Manager that configures the TikTok tags, triggers and variables for Pixel and Events API, and says “An event_id variable is automatically configured during setup” (checked 2026-10-17). Read its prerequisites before choosing it. The page lists “A Google Cloud Platform (GCP) account and a GCP billing account for provisioning your tagging server”, plus Publish, Approve, Edit and Read permissions on both the web and server containers.
That fits a team that hosts its tagging server on Google Cloud. If your server container already runs on Stape, the usual path is manual: add a TikTok server tag template to the existing container and build the event_id variable yourself. Stape’s TikTok Events API tag docs (checked 2026-10-17) describe its “TikTok events API tag” with fields for the access token, the Pixel ID and a Test Event Code, and an Event ID under “Server Event Data Override”.
Whichever path you take, inspect every generated or manual tag before publishing. A setup wizard creates plumbing. It can’t decide whether your Purchase means a paid order, a page view or a repeated webhook.
- Install the web container, create and deploy the server container, and connect a first-party tagging subdomain.
- Interactive path: open the website data source in Events Manager, pick the GTM integration and follow the flow. Manual path: add the server tag template and a shared
event_idvariable. - Review the web tags: Pixel code, triggers, consent conditions and the variable that supplies
event_id. - Review the server tag: access token, Pixel code, event mapping, match keys and purchase parameters.
- Test with Preview open on both containers before publishing anything.
ATA hasn’t published a dated capture of either path yet, so treat the steps above as the documented setup, not a recorded run.
Which fields the server tag maps, and who hashes them
Keep identification fields apart from purchase details. TikTok’s matching guidance lists the click ID, email and phone (hashing required), external ID (hashing required), IP address and user agent, and the first-party ttp cookie when used with the Pixel (checked 2026-10-17). In the browser the cookie is named _ttp; its value travels in the API field ttp. The page also notes that IP and user agent “are shared by default for Pixel and require manual configuration for Events API”.
| Field | Sent as | Where the value comes from |
|---|---|---|
event (Purchase) |
Plain | Your data model’s event name |
event_id |
Plain | One ID per conversion, shared with the Pixel copy |
ttclid |
Plain | Landing URL, stored at the first visit |
ttp |
Plain | The _ttp cookie, read in the browser or stored with the session |
| Hashed | Form or order record, normalised before hashing | |
| Phone | Hashed | Form or order record, normalised before hashing |
external_id |
Hashed | Your customer or CRM ID |
| IP address, user agent | As the template expects | The customer’s original browser request, or values stored at checkout for a webhook route |
value, currency |
Plain | The payment record |
Two mistakes are easy here. First, double hashing. Stape’s tag docs say the “Tag automatically hashes user data”. Its published template code (checked 2026-10-17, change log through 2026-09-03) passes any 64-character hex value through unchanged, so a web container that already sends SHA-256 hashes is fine with that tag. The risk is a component that hashes whatever it receives, such as a custom variable or another template: a hash of a hash never matches, so check each step once. Second, on a webhook route the server’s own IP and user agent are not the customer’s. Store the customer’s values when you capture ttclid and attach them later, or leave them out.
Send only what your consent state and the applicable law allow. Server delivery changes the route; it doesn’t create permission to track.
TikTok’s deduplication has a five-minute condition
TikTok’s event deduplication guide (checked 2026-10-17) separates two cases. Within one channel, copies with “identical event and event_id parameters arriving within a 48-hour window from the first event” are deduplicated. Across Pixel and Events API, copies are merged when they have the identical event and event_id “arriving after 5 minutes and within a 48-hour window from the first event”. TikTok keeps “the first event received” and enriches it.
Two consequences follow. Because the first copy is the one kept, the server copy should still carry full match keys even when it usually arrives second. And the page doesn’t say what happens to a cross-channel copy that arrives inside those first five minutes, so don’t invent a rule and don’t delay your server sends to game it. Check the outcome in Test Events.
The ID itself must be unique to the conversion, stable, and reach both sends. An order ID works for Purchase when both channels can read it. A random ID generated separately in each tag looks valid on both sides and still gives TikTok two purchases. If only the backend sends Purchase, there’s no overlap and no deduplication needed for that event. The Meta CAPI with GTM guide uses the same architecture with Meta’s own rules.
Server delivery doesn’t fix a bad event model
A thank-you-page Purchase routed through sGTM is still a thank-you-page Purchase: refreshes duplicate it, a failed payment can still redirect, and a copied URL fires it with no transaction. The server also can’t recreate ttclid or _ttp after they’re gone. Capture them when they’re available, store them with an attribution record, and join them to the later conversion. The incident above shows why that join needs its own daily hit-rate check: when it broke, the TikTok Purchase count looked healthy.
For the webhook route, the payment processor becomes the source of Purchase. Verify the signature and the accepted payment status, ignore repeated deliveries, join the order to stored attribution, and only then let the server container send one TikTok event. If a Pixel Purchase also exists, both use the same event name and event_id. The Stripe conversion tracking guide walks through that path, and it’s the purchase architecture ATA Edge uses for Meta.
Test browser-routed and webhook-originated events separately
Get a test event code from the Test Events tab of your Pixel in TikTok Events Manager and put it in the server tag’s Test Event Code field. Test events then appear in that tab. Take the code out before you publish the server container, so production events aren’t sent as tests. Keep GTM Preview open on the server container: Google’s server-side debug guide shows the outgoing request and the response TikTok returned.
For a browser-routed event, run one controlled action and follow it: the Pixel request in the browser Network panel, the request reaching the tagging subdomain, the client claiming it, the TikTok tag firing once, and the outgoing request carrying the event name, event_id, match keys, value and currency. Test Events should show the Pixel and API copies as one conversion.
For a webhook-originated Purchase there is no browser copy. Trigger a real test payment or replay a captured webhook into the server container, and check that one Purchase reaches Test Events with the stored ttclid and ttp attached. Then run the negative control: an unpaid or failed payment must produce nothing.
Accept the setup when all of this holds:
- One real test transaction creates one counted Purchase.
- Pixel and API copies share the same event name and
event_id. - The
_ttpvalue appears in the API’sttpfield when consent allows it. - Hashed identifiers are hashed once, by one component.
- Value and currency match the payment record.
- A webhook retry creates no second Purchase.
- An unpaid or failed transaction creates no Purchase.
- GTM Preview and TikTok Diagnostics show no unresolved error.
The unpaid-payment test checks that Purchase depends on payment confirmation, not on a page loading. After launch, check Events Manager for connection method, recent activity, match quality and diagnostics. An accepted HTTP request proves TikTok received a payload, nothing more.
ATA’s next GTM containers, in development, are built around this same contract: one event_id per conversion, stored attribution and webhook-validated purchases.
For a separate Kwai integration, use the Kwai Events API field reference. Its checkout name, click identifier and test flags have their own contract.