serkankaya.
Türkçe sürüm
Let’s work together ↗

What Is TikTok Events API? A Server-Side Setup Guide

What the TikTok Events API is and how to run it with the Pixel: event_id deduplication, ttclid and _ttp matching, a GTM setup and data protection steps.

The TikTok Events API is a server-to-server connection that sends website, mobile app, store and CRM events to TikTok directly from the advertiser’s server instead of the browser. TikTok recommends that advertisers running web conversions use the Events API together with the TikTok Pixel, with event deduplication.[1] In short, the Events API is a second data path that fills in the conversions the Pixel misses.

In this article I explain how the Events API works, which fields you need to send, how deduplication with the Pixel is set up, and what I watch for in Turkey under KVKK, Turkey’s data protection law. For the general concept, you may want to read what is server-side tracking first.

How does the TikTok Events API work?

The TikTok Events API works by having the system where the event happens (a web server, an e-commerce platform or a CRM) send the event data to TikTok’s API endpoint in an HTTPS request. Unlike the Pixel in the browser, the request does not leave the user’s device. That is why an ad blocker or a page closing early does not stop the event.

TikTok’s help page notes that connectivity issues and browser inconsistencies can affect conversions reported through the Pixel.[1] The Events API is designed to close that gap. The same document also states that web, app and offline (store, CRM) events can be sent through a single API.[1]

User purchases Server records the order Events API request TikTok Ads Manager
Server-side flow: the event reaches TikTok without depending on the user's browser.

In November 2023, TikTok announced that it had merged the separate endpoints for web, app and offline events into one consolidated endpoint.[4] This change simplified a structure that used to require a separate integration for each source. Today, a store sale, a web lead and a CRM stage can all be sent through the same integration.

The Events API also gives the advertiser control over data. In TikTok’s words, the advertiser only shares the data required for its marketing objectives.[1] This point matters for data protection, and I cover it separately below.

What is the difference between the TikTok Pixel and the Events API?

The TikTok Pixel sends events from the visitor’s browser, while the Events API sends the same or different events from the advertiser’s server. They are not competitors but two legs of the same measurement setup. The relationship between the Meta Conversions API and the Meta Pixel follows the same logic.

TikTok Pixel (browser)

  • Runs with JavaScript in the user's browser
  • Easily captures page view and interaction events
  • Is affected by ad blockers and connectivity issues
  • Uses the first-party _ttp cookie by default

Events API (server)

  • Runs from the advertiser's server or CRM
  • Sends definitive records such as orders and leads
  • Is not affected by browser restrictions
  • Also carries offline events such as store and CRM data
The Pixel carries behaviour, the Events API carries the definitive record; together they give a more complete picture.

TikTok also shares its own average for the impact of this combination. According to the company’s announcement, advertisers using the Pixel and the Events API together capture more events on average and see an improvement in cost per action.[4]

more events captured (average)
19%
improvement in cost per action (average)
15%
Source: TikTok for Business Blog, November 2023

These figures are TikTok’s own averages; they do not guarantee the same result in every account. I read numbers like these not as targets but as an indicator of why the setup matters.

Which events and parameters are sent to the Events API?

The Events API receives the standard events predefined by TikTok and custom events where needed; each event carries an event name, a timestamp, an event ID, user information and event parameters. TikTok’s standard event list includes events such as ViewContent, AddToCart, InitiateCheckout, AddPaymentInfo, Purchase, SubmitForm, Contact, CompleteRegistration and Schedule.[3] In older setups you may see the name CompletePayment for purchases; for a new setup, go by the current list.

EventWhen it is sentRecommended parameters
ViewContentWhen a product or service page is viewedcontent_ids, content_type, value, currency
AddToCartWhen a product is added to the cartcontent_ids, quantity, value, currency
PurchaseWhen an order is completedcontent_ids, value, currency
SubmitFormWhen a form is submittedLead ID as the event_id
ScheduleWhen an appointment is bookedAppointment ID as the event_id

The recommended parameters for standard events are listed on TikTok’s help page.[3] The same page also contains an important warning: sensitive data about visitors should not be shared with events, and event names must follow TikTok’s advertising policies.[3] For example, putting a treatment or condition name in an event name on a healthcare site would break this rule.

Match keys

Match keys are the pieces of information TikTok uses to link an event coming from the server to a TikTok user and an ad click. TikTok recommends passing all relevant match keys.[1] In practice, these are the fields I use most:

  • ttclid: The click ID appended to the landing page URL when an ad is clicked.
  • ttp: The value of the first-party _ttp cookie created by the TikTok Pixel.
  • email and phone: Email and phone hashed with SHA-256. Before hashing the phone number, I normalise it to E.164 format with the country code.
  • external_id: An ID from your own system, such as a customer or lead number; this is also sent hashed.
  • ip and user_agent: The IP address and browser information of the visitor who triggered the event.

According to TikTok, Pixel cookies expire 13 months after being set on a browser or last used, and first-party cookies can be passed through a combined Pixel and Events API setup for better matching.[5] That is why carrying the _ttp value into the server event is one of the cheapest ways to improve match quality.

How do you set up the TikTok Events API?

Short answer

How do you set up the TikTok Events API?

The TikTok Events API is set up by selecting a Pixel source in Events Manager, generating an access token and sending events from the server through a partner integration or a direct API request. If the same events are sent by the Pixel, the same event_id is used on both sides. The setup is verified with test events before going live.

  1. Create or select the web event source (Pixel) in TikTok Events Manager.
  2. Choose a setup method: commerce partner, data partner or direct API.
  3. Generate an access token for the Events API and store it on the server.
  4. Use the same event name and the same event_id in Pixel and server events.
  5. Add ttclid, _ttp and hashed user information to the server event.
  6. Verify with test events, then go live.

TikTok defines three setup paths.[4] With commerce partners such as Shopify and WooCommerce, setup takes a few minutes in Events Manager. With data partners such as Google Tag Manager, Segment or Tealium, setup runs through the partner’s platform. A direct integration is for advertisers who follow TikTok’s Marketing API documentation with their own developers.

  1. Prepare the source

    Select the web event source in Events Manager, note the Pixel code and generate an Events API access token. Keep the token on the server only and never send it to the browser.

  2. Write the event plan

    Decide in a table which event goes from the Pixel, which from the server and which from both. TikTok asks for events to be shared consistently across both sources throughout the user journey.

  3. Carry the identifiers

    On the first visit, read ttclid from the URL and store it in a first-party cookie or the form record. At the moment of the order or lead, generate an event_id and write it to the dataLayer.

  4. Send the server event

    Send the event to the Events API with the TikTok tag in server-side GTM or with your own code. Hash user information with SHA-256 before sending it.

  5. Test and monitor

    Send a few events with a test event code, check in Events Manager that events from both sources show the same event_id, then remove the test code.

Server-side setup with Google Tag Manager

Server-side Google Tag Manager (sGTM) is the method of receiving a browser event in a server container on your own domain and forwarding it to TikTok. I explained this setup step by step in the server-side GTM setup article; for hosting, services such as Stape can be used. The TikTok tag runs side by side with the Meta and Google Ads tags in the same container.

In this method the flow looks like this: the web container sends the event and the event_id value to the server container. The server container distributes the same event to both GA4 and TikTok. The TikTok tag is configured with the Pixel code, the access token and the event name mapping.

Direct API request

In a direct integration, the server sends a POST request to TikTok’s event endpoint with the access token in the header. The example below shows the structure of a purchase event; check the field names and version against TikTok’s current developer documentation before you implement it:

{
  "event_source": "web",
  "event_source_id": "PIXEL_CODE",
  "data": [
    {
      "event": "Purchase",
      "event_time": 1764151200,
      "event_id": "order-10482",
      "user": {
        "email": "<sha256 email>",
        "phone": "<sha256 phone>",
        "external_id": "<sha256 customer id>",
        "ttclid": "<stored ttclid>",
        "ttp": "<_ttp cookie value>",
        "ip": "203.0.113.10",
        "user_agent": "Mozilla/5.0 ..."
      },
      "properties": {
        "currency": "TRY",
        "value": 1250,
        "content_type": "product",
        "content_ids": ["SKU-123"]
      },
      "page": { "url": "https://example.com/thank-you/" }
    }
  ]
}

How are Pixel and Events API events deduplicated?

Short answer

How are TikTok Pixel and Events API events deduplicated?

TikTok Pixel and Events API events are deduplicated by sending the same event name and the same event_id from both sources. TikTok merges events whose two values match within 48 hours of the first event and keeps the first one received. If the Pixel and the Events API send different events, deduplication is not needed.

According to TikTok’s deduplication documentation, the event_id parameter must be shared through both the Pixel and the Events API.[2] When TikTok recognises that events overlap, it keeps the first event received for measurement and reporting and can enrich it with information from the later copy.[2] The document also defines three overlap scenarios: two Pixel events, two Events API events, and one Pixel event with one Events API event. In all three, the key is the same event and event_id value within a 48-hour window.[2]

On the Pixel side, event_id goes into the third argument of the ttq.track call:

// The order number is used as the event_id in both the Pixel and the server
ttq.track('Purchase', {
  contents: [{ content_id: 'SKU-123', quantity: 1 }],
  value: 1250,
  currency: 'TRY'
}, { event_id: 'order-10482' });

The deduplication logic is largely the same as Meta’s. I explained in detail how I generate the ID and carry it to both sides in the Meta deduplication article; you can use the same dataLayer variable in the TikTok tag. TikTok’s documentation also notes that an advertiser who sends different events from separate sources (for example AddToCart from the Pixel and Purchase from the Events API) does not need deduplication.[2]

Under KVKK (Turkey’s Personal Data Protection Law), explicit consent must be obtained from the visitor before sending personal data to the Events API, the privacy notice must mention the transfer to TikTok, and fields such as email and phone must be hashed. Because data sent to TikTok may fall under cross-border transfer rules, this step should be reviewed together with your legal team. This article is not legal advice.

These are the rules I follow in practice. If marketing permission has not been granted in the consent management platform (CMP), neither the Pixel nor the server event fires with personal data. In the server container, the consent state is read with every event, and the TikTok tag does not run without permission. I explained the equivalent setup on the Google side in the Consent Mode v2 article.

In YMYL areas such as health tourism, the care required doubles. TikTok’s standard events documentation already asks advertisers not to share sensitive data with events.[3] For that reason I do not put treatment names, diagnoses or patient-specific information into event parameters. A lead event only carries hashed contact information and an anonymous lead ID.

Post-setup checklist

After setup, understanding whether the Events API works correctly means checking event counts, deduplication and match keys together. The list below contains the points I look at in the first days after going live:

TikTok Events API post-launch check0/8

The last item is a health indicator to check regularly, not once. If the count in Ads Manager is clearly higher than the store dashboard, deduplication may not be working. If it is clearly lower, server events or match keys may be missing.

Conclusion

The TikTok Events API is a connection that fills in, from the server, the conversions the Pixel misses in the browser and gives TikTok’s bidding algorithm more complete data. A correct setup rests on three foundations: working together with the Pixel, using the same event name and event_id on both sides, and carrying match keys such as ttclid and _ttp to the server without losing them. In Turkey, KVKK consent and hashing must be added to these.

As a next step, I suggest mapping out your current event plan and deciding which event goes from which source. You can find my performance marketing approach, where I measure TikTok together with Meta and Google Ads, and my measurement infrastructure experience on the about page.

Key terms

TikTok Events API
TikTok Events API is a server-to-server data connection that forwards an advertiser's web, app, store and CRM events from its own server to TikTok. TikTok uses these events for measurement, optimisation and targeting. On websites, it is recommended to run it alongside the TikTok Pixel.
ttclid
ttclid is the ID parameter appended to the landing page URL of a user who clicks a TikTok ad, identifying that click. When sent with a server event, it lets TikTok link the conversion to the right ad click. It needs to be read and stored on the first visit.
TikTok Pixel
TikTok Pixel is a JavaScript code added to a website that sends visitor actions such as page views, add to cart or purchases from the browser to TikTok. By default it uses the first-party _ttp cookie. Together with the Events API, it forms a redundant measurement setup.

Frequently asked questions

Should the TikTok Pixel and Events API be used together?

Yes. TikTok recommends that advertisers running web conversions use the Pixel and the Events API together, with event deduplication. The Pixel carries browser behaviour, while the Events API carries the definitive record from the server. If both sources send the same event, the same event_id must be present on both sides.

How does TikTok deduplicate events?

TikTok deduplicates events that carry the same event name and the same event_id within a 48-hour window from the first event. The first event received is kept and can be enriched with extra information from the later copy. If the Pixel and the Events API send different events, deduplication is not needed.

What is ttclid and why should it be stored?

ttclid is the click ID appended to the landing page URL when a user clicks a TikTok ad. When this value is added to the server event, TikTok can link the conversion to the right ad click more easily. That is why it should be read on the first visit and stored in a cookie or in the form record.

Do I need a developer for the Events API?

Not always. Setup through commerce partners such as Shopify and WooCommerce, or through data partners such as Google Tag Manager, can be done in a few steps in TikTok Events Manager. A direct API integration, for businesses sending data from their own CRM or custom stack, is a developer task.

Which personal data is sent to the Events API?

For matching, email, phone and external_id are usually sent hashed with SHA-256; the IP address and browser information can also be added. TikTok asks advertisers not to share sensitive data with events. In Turkey, this transfer requires explicit consent and a privacy notice under KVKK.

Sources

  1. TikTok for Business Help Center: About Events API
  2. TikTok for Business Help Center: About Event Deduplication
  3. TikTok for Business Help Center: About Standard Events in TikTok Ads Manager
  4. TikTok for Business Blog: TikTok launches enhanced Events API with consolidated endpoint
  5. TikTok for Business Help Center: About using cookies with TikTok Pixel