How to set up TikTok Events API

Oct 24, 2022
Aug 28, 2021
Also available in

In 2021, 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 APIserver-side GA4, and UA

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. 

How to set up TikTok events API?


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.  

tiktok events api tag

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 http request details
tiktok ads manager


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.

Tagged with:gtm serversGTM tag

Host your GTM server at Stape