TikTok Ads
How to set up TikTok Ads tracking through the TikTok Events API
This guide shows you how to configure the TikTok Events API in your Google Tag Manager server container, step by step.
Before you start
Make sure you have:
Step 1: Add the tag template
Open your GTM server container and go to Templates.
Under Tag Templates, click Search Gallery.
Search for the TikTok Events API tag template and add it to your workspace.

Step 2: Create the Events API tag
Go to Tags and create a new tag. Choose TikTok Events API as the tag configuration.
Under Event Name Setup Method, choose Inherit from client. The tag will then use the event names of the incoming GA4 requests.
Fill in your Access Token in the Access Token field.
Fill in your TikTok Pixel ID in the TikTok Pixel ID field.

Set the four checkboxes as follows:
Generate Browser ID (_ttp) cookie if not exist
Disabled
Enable Event Enhancement
Enabled
Override Cookies Settings
Disabled
Use Optimistic Scenario
Disabled
Generate Browser ID (_ttp) cookie if not exist
The _ttp cookie holds the browser ID. In a setup with a TikTok Pixel, the Pixel creates this cookie itself, so the option is redundant there. Recommendation: leave this disabled. A _ttp value your own server invents is not an identifier TikTok issues or recognises. TikTok cannot tie it to a person on its own. All it can do is group events that came from the same browser, and that only works if the cookie is reliably written to your tracking domain and returned on every following request.
Enable Event Enhancement
This option lets the tag store user data in a separate HttpOnly cookie (gtmeec-tt) on your own domain. When a later event arrives without user data the tag enriches that event with the stored data.Recommendation: enable this. It raises your event match quality, which improves attribution and TikTok's ability to optimise your campaigns.
Override Cookies Settings
The tag writes three cookies on your domain: the click ID, the browser ID and the event enhancement cookie. This option lets you override the domain and the SameSite attribute all three are written with. By default the domain is determined automatically, based on the page URL of the incoming event, with the request headers as a fallback. That is correct for a normal single-domain setup. Only enable it if the automatic behaviour is wrong for your situation, for example when you need the cookies set on your top-level domain because you track across subdomains, or when your SameSite policy has to differ from the default.
Use Optimistic Scenario
Normally the tag waits for TikTok's API to confirm that the event was received before reporting back to GTM. With this option enabled, the tag reports success immediately, without waiting for a response. Recommendation: leave this disabled. You lose your only view of whether events actually arrive, which makes tracking problems very hard to spot.
Step 3: Add a trigger
Click Triggers under the tag configuration, then click the blue plus icon in the top right to create a new trigger.
Choose the grey Custom option as the trigger configuration.
Select Some Events to add conditions. Add your condition. Common options are:
Based on specific event names
{{Event Name}}matches RegExeventname|eventnameAlways include
page_viewas the first event name.
Without a condition, if you want to send every GA4 event to the Conversions API
{{Client Name}}equalsGA4

Save the trigger and the tag.
Step 4: Test
Use the server container preview mode to check that the Facebook Conversion API tag fires on incoming events.
For a more thorough check, add a Test ID to the tag and open the Test Events tab in TikTok Ads Manager. Your events should appear with Server listed as the source. Remove the Test ID again once you are done testing.
Optional: Add or override event parameters
By default, the tag builds its payload from the incoming event on its own. It reads the parameters your web container sends to the server container and maps the ones it recognises to their TikTok equivalents. For most setups that is enough.
You can override that mapping, or add parameters the tag does not pick up by itself. Open your TikTok Events API tag and expand the sections below the main settings:
Server Event Data Override — for event-level fields, such as the event ID, referrer, timestamp and URL.
User Data — for identifying parameters, including email, phone number, external ID, click ID and browser ID.
Properties — for the commercial details of the event, such as value, currency, content and query.
Each section works the same way: you add a property, choose which field you want to fill, and give it a value. That value is normally a variable pointing at a parameter in the incoming event. Anything you enter manually takes precedence over what the tag mapped automatically.
There are two reasons to do this:
The parameter arrives, but the tag does not map it. Your web container may send a value under a name the tag does not recognise, or in a structure it cannot read. Pointing the field at the right parameter yourself gets it into the payload.
The parameter is wrong or missing. If the automatic mapping produces a value you do not want to send, an override replaces it.
Which parameters are available to you depends entirely on what your GA4 event tags send from the web container. There is no universal list. Open the server container preview mode, look at an incoming request, and work from the parameters you actually see there.
Two things to keep in mind. The tag hashes user data automatically, so pass values in plain text and do not hash them yourself first. And only map parameters you have a legal basis to send: anything you add here goes to TikTok, so it needs to be covered by your consent setup and your privacy statement.
Last updated
Was this helpful?

