Skip to content
Back to the blog

The TikTok Events API, explained for online stores

David Grelle on

The TikTok Events API, explained for online stores

Your TikTok ads are getting clicks, Shopify is getting orders, and TikTok Ads Manager is reporting far fewer purchases than you can see with your own eyes. So TikTok decides your ads aren't working, spends less on the people who actually buy, and your cost per sale creeps up. The TikTok Events API exists to fix exactly this.

Most of the time the ads aren't the problem. The tracking is. The TikTok pixel runs in the shopper's browser, and browsers lose a lot of events these days. The Events API is TikTok's answer : a way to send the same events from your server, where browsers can't interfere.

This guide covers what the Events API is, how it works next to the pixel, the ways to set it up, and the few details that decide whether it actually helps.

Why the TikTok pixel alone misses sales

The TikTok pixel is a small piece of code on your website. When someone views a product, adds to cart or buys, it sends a message to TikTok. Each message is an event.

The trouble is that the pixel depends on the shopper's browser cooperating, and it often doesn't:

  • Ad blockers stop the pixel from loading at all.
  • Browser privacy features shorten how long cookies last. A cookie is a small note a website leaves in your browser so it can recognize you later. The TikTok pixel uses one, called _ttp, to recognize returning visitors. When it's cleared, TikTok can't connect a purchase to an ad clicked a few days earlier.
  • Shoppers leave early. If someone pays and closes the tab before the confirmation page loads, the pixel never sends the purchase.

Picture Jess. She taps your ad in the TikTok app on Monday, browses, leaves. On Thursday she comes back through a Google search on her iPhone, buys, and closes Safari the second the payment goes through. The pixel may never report that sale, and even if it does, TikTok may not know it was the same Jess who tapped the ad.

What is the TikTok Events API?

The TikTok Events API is a way to send events to TikTok from a server instead of from the shopper's browser. A server is a computer that runs your store's systems behind the scenes. Because it isn't on the shopper's phone, ad blockers and browser settings can't stop it.

In practice, when an order is placed, your system sends TikTok a message like: "Purchase, order 1042, $68, USD, at 3:14pm, and here are some clues about who bought." TikTok receives it the same way it would a pixel event.

You'll sometimes see it called Events API 2.0. That's the current version. The original version was retired, so any setup you build today uses 2.0.

Server events need clues the browser gives for free

There's a catch. When the pixel sends an event, the browser automatically attaches useful information: the _ttp cookie, the shopper's IP address (roughly, the internet address of their connection) and their user agent (a short description of their device and browser).

A server has none of that unless you hand it over. Send a purchase from your server with nothing attached, and TikTok gets a sale it can't tie to any person or ad. It counts, but it can't help your campaigns learn.

That's why TikTok recommends running the pixel and the Events API together. The pixel brings the browser's clues, the server brings reliability, and TikTok keeps one copy of each event.

The ways to set up the TikTok Events API

1. TikTok's Shopify app

TikTok's app for Shopify can set up the pixel and server events for you, with no code. You pick your data sharing level in the app's settings, and TikTok takes care of the connection.

Good for: Shopify stores that want a free, quick start.

The trade-off: you can't see or change much of what's sent. It only covers TikTok, so every other ad platform needs its own setup. And each platform ends up with its own view of your customers, which is part of why their numbers never agree.

2. A partner or tag manager integration

Many ecommerce platforms and tools have a built-in TikTok connection you switch on. Another common route is server-side Google Tag Manager : your store sends events to a tracking server you rent and run, and that server forwards them to TikTok.

Good for: teams with a developer who wants control over every field.

The trade-off: with server-side Tag Manager, you pay for hosting and you own the maintenance. Someone has to wire up deduplication and the customer clues below, and fix it when your checkout changes.

3. A direct integration with the API

Your developer writes code that sends events straight to TikTok's API. You generate an access token (a long password that lets your server send data to your pixel) in TikTok Events Manager, under your pixel's settings.

Good for: custom stores or teams with engineering time to spare.

The trade-off: everything is on you, including the details most setups get wrong.

4. A server-side tracking platform

Tools like Soran capture events on your store, keep a copy in your own analytics, and forward them to TikTok with the hard parts handled. We compare the main options in top server-side tracking tools .

Good for: stores advertising on more than one platform, or anyone who'd rather not maintain tracking code.

Whichever route you choose, the same few details decide whether it works.

Detail #1: counting each sale once

If the pixel and your server both report a purchase, TikTok has two messages about one sale. It needs to know they're the same, or it counts the sale twice. Recognizing and dropping the duplicate is called deduplication.

TikTok matches the two copies on three things:

  • The pixel ID. This is the code that identifies your pixel in TikTok. Both copies must go to the same one.
  • The event name. Both must say exactly the same thing, for example Purchase.
  • The event ID (event_id). This is a reference you attach to the event. If both copies carry the same event ID, TikTok treats them as one sale.

TikTok deduplicates matching events that arrive within 48 hours of the first one, and keeps the first copy it received for reporting. If the second copy lands within about five minutes, TikTok also merges any extra details it carries, like an email the first copy lacked, into the first one. Either way, the sale is counted once.

What should the event ID be? For purchases, use your order ID. The browser and the server both know it, it never changes, and every order has its own. Don't generate a random number on each side: two random numbers will never match, and you're back to counting every sale twice.

What goes wrong when you skip this: your purchase count roughly doubles, your ROAS (return on ad spend: revenue from ads divided by spend) looks fantastic, and TikTok's optimization gets fed a picture of your store that isn't real.

A note on event names

TikTok renamed its CompletePayment event to Purchase. Older setups still send CompletePayment and TikTok converts it automatically. Still, for deduplication the safe choice is to have your browser and server copies use the same name. Pick Purchase on both and you never have to wonder whether the two get matched.

Detail #2: helping TikTok recognize who bought

Getting the purchase to TikTok is half the job. The other half is helping TikTok work out who bought, so it can link the sale to the ad they saw. These are the clues that matter:

Clue

What it is in plain words

Good to know

Email and phone

How the customer contacted you

Scrambled (hashed) before sending.

External ID (external_id)

Your own ID for this customer

Must be the same value from browser and server. Hashed.

Click ID (ttclid)

A code TikTok adds to your link when someone clicks your ad

Ties the sale to that exact click.

Cookie ID (ttp)

The value of the _ttp cookie the pixel sets in the browser

Only readable while the shopper is on your site.

IP address and user agent

The shopper's connection and device

Must be the shopper's, not your server's.

Hashing turns " jess@example.com " into a long scrambled string that can't be turned back into the email. TikTok does the same to the emails it has and compares the scrambled versions. TikTok expects SHA-256 hashing, which is the standard method most tools use. Before hashing, tidy the value up: lowercase emails with no spaces, phone numbers in full international format like +14155550123. Otherwise the same customer produces a different scrambled value each time, and nothing matches.

Mistake 1: sending your server's IP address

If the server sends the purchase and you don't pass along the shopper's IP address and device, TikTok sees your server's details on every order. Thousands of purchases all appear to come from one computer in a data center. Record the shopper's IP address and user agent while they're on your site, and send those with the order.

Mistake 2: losing the click ID

When someone taps your ad, TikTok adds ttclid to the link. If your site doesn't save it when they land, it's gone by the time they check out, especially if they browse a few pages first. The fix is to store it when the visitor arrives and carry it through to the order.

Mistake 3: attaching the wrong click

The opposite mistake is just as bad. If you save a customer's last TikTok click on their profile and attach it to every future order, you'll give TikTok wrong information. Jess clicked an ad two months ago and bought today after an email. Attaching that old click tells TikTok an ad earned a sale it had nothing to do with.

A click belongs to the visit and checkout where it happened. If you don't know which click led to an order, send the order without one. A missing click costs a little matching. A wrong one teaches TikTok to reward the wrong ad.

Mistake 4: two different customer IDs

If the pixel sends a browser-generated ID as external_id and the server sends your store's customer number, TikTok sees two different people. Pick one identifier and use it on both sides. A store customer ID works well because it stays the same across devices.

Detail #3: sending the right details on each event

For purchases, TikTok needs more than the event name:

  • **value**: the order amount. Without it, TikTok can't report revenue or ROAS.
  • **currency**: a three-letter code like USD or EUR. A value without a currency is meaningless to TikTok.
  • **content_id** and **content_type**: your product IDs, and whether the event is about a product or a product_group. If you run catalog ads, the IDs must match your TikTok catalog.
  • Event time: the time the purchase happened, not the time your server got around to sending it.

Your TikTok Events API setup checklist

  1. Decide how you'll send server events: TikTok's app, a partner or tag manager, your own code, or a tracking platform.
  2. Report purchases from the store itself. Shopify can notify your server the moment an order is created. This notification is called a webhook, and it arrives even if the shopper never sees the confirmation page.
  3. Use your order ID as the event ID on both the pixel and server copies, with the same event name on both.
  4. Capture the shopper's clues on your site: ttclid from the landing page link, the _ttp cookie, IP address and user agent. Pass them along with the order.
  5. Normalize and hash email, phone and external ID before sending.
  6. Send value, currency and product IDs on every purchase.
  7. Test before going live. In Events Manager, open your pixel's Test Events tab and use the test code for server events. Each event shows up with whether it came from the browser or the server.
  8. Check deduplication after launch. Compare a week of TikTok purchases with your actual orders from TikTok traffic. Roughly double means your event IDs or names don't match.

One tool won't help you here: the TikTok Pixel Helper browser extension only sees what happens in your browser. Server events never pass through it, so use Test Events and Events Manager's diagnostics to check them.

How Soran handles it

Soran takes the checklist above off your plate for TikTok and the other platforms you advertise on.

  • Purchases are recorded server-side, so ad blockers, tracking prevention and closed tabs don't lose them.
  • Conversions are forwarded to TikTok with duplicate removal, and you can view and edit the fields that are sent. TikTok is connected once.
  • The same setup covers more than TikTok. Meta, Taboola (for orders from visitors who came through a Taboola ad) and any custom webhook endpoint can receive conversions from the same tracking.
  • TikTok spend comes in too, so TikTok sits next to your other channels in one attribution report. Past spend backfills 30 days, because that's TikTok's limit.

Because every event also lands in your own analytics, you see the full path each customer took, not just TikTok's version of it. That's the basis of multi-touch attribution . The same ideas on the Meta side are covered in our guide to the Meta Conversions API on Shopify , and the bigger picture is in server-side tracking for Shopify .

Frequently asked questions

Do I still need the TikTok pixel if I use the Events API?

TikTok recommends using both. The pixel sees what only the browser knows, like the _ttp cookie and on-site behavior. The Events API catches the events the browser drops. Deduplication makes sure each sale counts once.

Is the TikTok Events API free?

TikTok doesn't charge for it. What you pay for, if anything, is the thing that sends the events: TikTok's Shopify app is free, server-side tag managers have hosting costs, and tracking platforms charge a subscription.

How long is TikTok's deduplication window?

48 hours. Events with the same pixel ID, event name and event ID that arrive within 48 hours of the first one are merged, and the first copy received is kept.

Why is TikTok counting my purchases twice?

Almost always because the browser and server copies don't share an event ID, or because two separate setups (say, theme code and an app) both send the purchase. Use the order ID as the event ID on both copies, keep the event names identical, and remove any duplicate installation.

Does the Events API get around privacy settings?

No, and it shouldn't. It recovers events the browser loses for technical reasons, like a confirmation page that never loaded. If a shopper has declined tracking, respect that choice on the server too.


Want TikTok receiving every sale, counted once, without maintaining the plumbing? Book a demo and we'll walk through your setup.

You have read how attribution should work. Now see it on your own store.

  • No credit card to start
  • Every report and all ten models from day one
  • Your data exports whenever you want it
  1. 01

    Connect your store

    Shopify authorizes in a click and checkout tracking installs itself.

  2. 02

    Pick a goal

    The conversion you actually get paid for. Soran credits every touch that led to it.

  3. 03

    Read your first report

    Spend against the revenue it earned, on all ten attribution models.