Stape
Search
Try for free

How to set up TikTok Events API

Ira Holubovska

Ira Holubovska

Author
Updated
Apr 25, 2025
Published
Aug 28, 2021
Also available in

TikTok is the hottest social media app with over 1 billion monthly active users. That is why most marketers decide to bring it into their advertising strategies.

People use TikTok on their mobile phones more than anywhere else. For quite a while, only Facebook was talking about Apple’s recent privacy updates. Only this time, new iOS tracking restrictions will also apply to TikTok ads. Because of the iOS restriction, TikTok custom audiences and events do not include people who opted out of tracking in iOS 14.  

How can you make TikTok tracking more accurate? The answer is server-side tracking. This article will describe how to set up the TikTok events API using Google Tag Manager.

What is the TikTok events API?

TikTok events API is a server-side integration that allows you to send website or app events from your server directly to the TikTok server. It works similarly to the TikTok pixel. You can use TikTok events API to send conversion events, collect custom audiences, dynamic product ads, campaigns optimization.

What are the main benefits of the TikTok events API?

TikTok API events have the same benefits and are very similar to ss tracking solutions from other platforms. Check our earlier posts about FB Conversion API, and server-side GA4.

Here are the main benefits of using TikTok events API:

1. Accurate event tracking.  With server-side tracking, you will be able to collect more events. TikTok events API is resistant to ad blockers, ITPs, and other tracking restrictions. This way, you can increase the accuracy of conversion tracking of your campaigns. It will give you a better understanding of what campaigns are converting and bring more sales.

2. Better custom audience quality.  Since tracking won’t be blocked, your custom audiences will include all users. 

3. Data security. With server-side tracking, the personal information of your customers stays secure. 

4. Privacy controls.  Keep your marketing efforts intact with rapidly evolving privacy requirements that let you adapt what data you share and when you share it.  

5. Enriched data. You can send additional data to TikTok, for example, from your CRM. Use this data to have a better understanding of campaign performance or building custom audiences. 

What are the main disadvantages of the TikTok events API?

Even though server-side tracking is a fantastic new technology, it has its disadvantages as well. 

1. More complicated integration. SS tracking works in a slightly different way than browser tracking. That is why it may take quite some time to integrate it with your site. The best way to set up TikTok events API or ss tracking for any other platform is using the Google Tag Manager server container. BTW we can help. 

2. It requires a cloud server and additional cost. To set up ss tracking, you will need to configure a cloud server that you will use to send requests to different data points. 

3. It is still new. TikTok events API is a new technology, which means that we should expect more updates to come. That is why you’ll need to stay on top of all the upcoming changes. 

How does the TikTok events API work?

TikTok events API works similarly to Facebook conversion API. TikTok uses Click ID and user data to match events with TikTok users. The more user data you send to TikTok, the higher the chances of attributing the events to their users. TikTok events API has the same features and browser events. It can be used to create audiences, measure conversions, and optimize TikTok algorithms. 

Starting February 28, 2022, TikTok supports event deduplication. Meaning that now you can use both pixel and events API, similarly to Facebook CAPI. If you want to send events from both browser and server, ensure you add event_id.

Every time someone clicks on the TikTok ad, a Click ID (ttclid) is added to the URL. That is a unique identifier that is valid for 30 days. You can store the TikTok click ID (ttclid) and share it back to the TikTok events API that will help to attribute events to your campaigns. 

To increase TikTok API events match quality score, you can send user data, such as email, phone number, user ID, user IP, and user agent. All user information should be transformed to lowercase and hashed using SHA256 on the client-side.

Besides user data, you can send properties, objects and event parameters. 

Ways to set up TikTok Events API

There are two ways to set up the TikTok Events API: Events API Gateway and using the server GTM. In the section below, we consider both methods in detail.

TikTok Events API Gateway

Stape's TikTok Events API Gateway is the newest and simplest solution for implementing the TikTok Events API. It allows you to skip the complexities of configuring event deduplication and avoid spending excessive time on tagging. It allows you to send user parameters and events directly from the server while also supporting multiple Pixels in a single instance, even across different Business Manager accounts.

It works in minutes — set up the TikTok Events API without the need for manual server-side tagging implementation. With the TikTok eAPI Gateway, you can immediately enhance the accuracy of conversion tracking and attribution. 

TikTok Events API Events API through sGTM

Stape’s TikTok Events API tag allows you to send website or app events from your server directly to the TikTok server. You can collect custom audiences, create dynamic product ads, and optimize campaigns.

It requires technical knowledge for setup and configuration, including managing infrastructure such as server hosting and permissions.

Key features of TikTok Events API tag setup:

  • Full flexibility to customize and integrate multiple server-side tags (not just TikTok).
  • Allows advanced configurations, such as combining data from various sources and enriching event data before sending them to TikTok.
  • Useful for businesses already using server-side Google Tag Manager for other platforms like Meta or Google Ads.
  • Requires ongoing maintenance and monitoring.

Key features of TikTok Events API Gateway setup:

  • Fully hosted and managed by Stape.
  • Automatically handles server-side conversion tracking and event delivery to TikTok.
  • Provides reliability and scalability without setting up a separate GTM server container.
  • Less flexibility compared to GTM for custom implementations or adding multiple tags beyond TikTok.

Comparison table

TikTok eAPI tagTikTok eAPI Gateway
Setup complexityMore complex configuration, you need web and server GTM containers.Easier to set up.
Ability to set up server-side tracking for other platformsMore flexible, enabling setup for various platforms.Setup is possible only for TikTok.
PriceDepends on the number of requests, check the calculator to see the price for your website.10$/month for each Pixel or 100$/month for 100 Pixels.

What tracking method should you choose?

TikTok Events API tag suits best for:

  • Businesses with in-house technical expertise or dedicated support teams.
  • Advanced users who want full control over their tracking setup.

TikTok Events API Gateway suits best for:

  • Small to medium businesses or advertisers running TikTok ads and looking for a quick and efficient way to enable server-side tracking.
  • Users who want a ready-to-go solution without deep technical involvement.

How to set up TikTok Events API Gateway

Before you begin, ensure that TikTok web tracking is already configured on your site, whether it's implemented through a GTM container, embedded directly in the website code, or integrated via a plugin. This setup allows you to use existing web events.

1. Create a TikTok Events API Gateway on Stape

1.1. Create an account or log in to Stape. Click on “Create Gateway” in the TikTok section.

1.2. Write in the gaps:

  • Gateway name. You can create a random name.  
  • Admin email. This email will be used to manage your TikTok Events API Gateway and can be different from your Stape account email. It should be unique for each Gateway.
  • Server location. Select a location closer to your website visitors. 

Click “Create TikTok Events API Gateway”.

1.3. Choose a subscription plan. Stape offers:

  • 7-day free trial.
  • Pay as you go plan - 10$/month per Pixel.
  • Ultimate plan - 100$/month for 100 Pixels.

1.4. Wait till the status of your gateway is “Running”.

2. Connect your Pixel

2.1. Click on “Finish TikTok Gateway setup”. You will be redirected to the login interface of TikTok Gateway.

2.2. In the Events API Gateway hub click on “View details” and then - “Connect Data Source”.

2.3. Choose the account and Pixels you’d like to connect and confirm your choices.

2.4. You will see the added pixel in your dashboard.

Using a custom domain in your TikTok Events API Gateway can improve measurement performance. It allows you to choose the subdomain for the Pixel's communication with the Events API Gateway. This custom domain should match the subdomain used for firing the TikTok Pixel.

3.1. Click “Settings” on the menu. Push the button “Set up domain”.

3.2. Choose domain and receive DNS records to configure.

3.3. Log in to your DNS provider and set records (if you use Cloudflare, the settings should look like on the screenshot).

 3.4. And that’s it! You’ve successfully set up your subdomain.

This will help you increase the protection of your events from ad blockers.

After validating your Data routing domain you will see a link that you can use to download TikTok js on your site. Click on “View base code” and copy the snippet.

5. [Optional] Add new Pixels

You can use a single TikTok Events API Gateway to set up multiple TikTok Pixels. Additionally, Pixels from various TikTok Business Accounts can be connected to the same Events API Gateway, provided you have admin access to all the Pixels. 

The process is straightforward: configure your TikTok Events API Gateway, then add new Pixels through the hub interface. Simply click on “Connect data source”.

6. Test your setup

As mentioned before, TikTok Events Gateway uses web events to route them via the server. 

6.1. Within 30 minutes of connecting your pixel to the TikTok eAPI Gateway hub, you should notice that the event count is no longer zero, and you should also see the names of the events that have been received. 

6.2. You can also verify that events are sent correctly to the TikTok Events APIG hub by checking the website console:

  1. Open your browser developer network tab on your site.
  2. Check that events were sent to your Events API Gateway URL (look at the screenshot below).

How to set up TikTok events API via server GTM?

!

Starting February 28, 2022, TikTok supports event deduplication

You can combine web and server tracking for TikTok. If you do so, please ensure to add event_id to web and server tags. Our TikTok events API supports deduplication, as well as event_id variable supports the TikTok standard of event_id. Guide bellow describes setting up only TikTok events API, without pixel events or deduplication.

2. Send required data to the server container. We have blog posts that describe two methods: sending data using GA4 or using Data Tag.  

3. Add TikTok events API tag from the GTM template gallery.  

4. Generate Access Token. To do that click Assets -> Web Events ->  Open pixel -> Click Settings -> Click "Generate Access Token".

5. Create a TikTok tag in the server container. Choose event -> Add TikTok API Access Token -> Add TikTok Pixel ID (You can only add a single Pixel ID per tag).

6. You can add event parameters under Server Event Data Override. These parameters include event ID, referrer, timestamp, and URL. Our tag will automatically add event parameters, but you can select to override and send it manually. 

7. To send user data, open the user data section. Here you can add the IP address, user agent, email, external ID, and ttclid. Ip address, user agent and ttclid will be added automatically.

8. To send product data, use properties sections. You can send content, currency, description, query, and value. 

9. Add trigger.

tiktok trigger add
tiktok trigger add
tiktok http request details
tiktok http request details
tiktok ads manager
tiktok ads manager

Conclusion

The TikTok events API allows sending data from your server to the TikTok app. You can use it to improve the accuracy of event tracking and expand the size of your custom audiences. The events API has the same abilities as browser tracking. Still, you’ll benefit from better privacy and performance due to its ability to bypass client-side limitations and have more accurate information about user behavior.

author

Ira Holubovska

Author

Ira has 10+ years of digital marketing experience, with the last 5 focused on server-side tracking. She understands how and when it works across various digital marketing scenarios.

author

Comments

Try Stape for all things server-sideright now!