Sending TikTok event data with Events API

Imagine, that you have a cool offer for a TikTok campaign but the advertiser does not support the TikTok tracking pixel. It’s not ideal. In this case, you can use Events API. I have been searching for decent articles covering this topic but in vain. So I’m here to break this matter down and walk you through it. 

 

What is TikTok Events API?

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

 

The main advantages of the TikTok Event API

  1. Accurate event tracking. Thanks to server-to-server tracking, you can collect more events. TikTok Events API is not hindered by ad blockers and other data masking solutions. This means that you will have the most accurate conversion tracking in your campaigns. 
  2. The best quality of the custom audiences. Since there is no way to stop the event tracking, you will have the real picture of your custom audiences. 
  3. Data security. Thanks to server-to-server tracking, the users’ data remains secure. 
  4. Privacy. Keep your marketing ideas to yourself with the rapidly changing privacy requirements that give you control over the kinds and amount of data you send. 
  5. Extended data. You can provide TikTok with extra data, for example, from your CRM system. Use this opportunity for making even better custom audiences.

 

How does the TikTok Event API work?

TikTok Events API operates similar to Facebook API. TikTok uses Click ID and user data to attribute events to TikTok users. The more user data you send to TikTok, the better it matches events with users. TikTok Events API has the same capabilities as browser events. It can be used to create audiences, measure conversions, and optimize TikTok algorithms.

 

Every time someone clicks on a TikTok ad, a click ID (ttclid) is added to the URL. This is a unique identifier that is valid for 7 days. You can save the TikTok click ID (ttclid) and pass it back via the TikTok Event API, and thus attribute the events to your campaigns.

 

You can send more data to make the event attribution more accurate. For example, external_id, phone_number, email, IP, and User Agent of the user who performed the target action. Since you often don’t have access to some data, you can use my set-up for sending click ID, IP, and User Agent. If you have access to other types of user data, I recommend hiring a developer for a more detailed set-up. 

 

Check out the official TikTok documents here: https://ads.tiktok.com/marketing_api/docs?rid=p41a33fdhon&id=1701890979375106.

If you have any difficulties with the set-up, ask a question in the comments under this post.

 

TikTok set-up process

Open Events Manager and go to Web Events. Click Set Up Web Events and select the Events API.

Click Next and enter a name for the pixel. Select Manually Set Up Events API and click Setup.

Skip the next screen and hit Next.

Now, click Generate Access Token and save the token. If you can’t find the TikTok pixel ID, it is highlighted in red at the top of the screenshot.

 

Binom set-up process

In Binom, create a TikTok traffic source

You should always enter the {pixel} and {ad} tokens manually in the campaign URL. As far as I know, TikTok does not support dynamic parameters other than ttclid (click ID). Here you can access more information about ttclid. Ttclid should always be at the end of the campaign URL.

Now download this file and change the Access-Token to your own. The script is set for the CompleteRegistration event. If you need a different event, make the necessary changes to the script.

Upload the file to the tracker server, for example to a LANDERS folder. I recommend creating an additional folder for such files within the LANDERS folder. In my case, it will be a folder named “tt”.

 

Create a new ad campaign for TikTok in Binom. Insert this link into the S2S Postback field 

https://your_domain.com/landers/tt/ttapi.php?pixel_code={t1}&callback={t3}&ip={ip}&user_agent={user_agent}&currency={cnv_currency}&value={payout}

 

and don’t forget to add the file that you have just uploaded to the server as a destination. Instead of {cnv_currency}, I recommend adding one of the TikTok currencies manually:

 

[“AED”, “ARS”, “AUD”, “BDT”, “BIF”, “BOB”, “BRL”, “CAD”, “CHF”, “CLP”, “CNY”, “COP”, “CRC”, “CZK”, “DKK”, “DZD”, “EGP”, “EUR”, “GBP”, “GTQ”, “HKD”, “HNL”, “HUF”, “IDR”, “ILS”, “INR”, “ISK”, “JPY”, “KES”, “KRW”, “KWD”, “KZT”, “MAD”, “MOP”, “MXN”, “MYR”, “NGN”, “NIO”, “NOK”, “NZD”, “PEN”, “PHP”, “PKR”, “PLN”, “PYG”, “QAR”, “RON”, “RUB”, “SAR”, “SEK”, “SGD”, “THB”, “TRY”, “TWD”, “USD”, “VES”, “VND”, “ZAR”]

Be careful and make sure that you have correctly specified the path to the script. Save the campaign when you are sure that everything is correct.

 

Activating the pixel and testing the set-up

Now you need to activate the pixel so that you can select for a new ad campaign. Copy the link from S2S Postback and paste it into the browser. Add your parameters to the URL. You can leave the callback as {t3}.

 

https://your_domain.com/landers/tt/ttapi.php?pixel_code=your_pixel&callback={t3}&ip=your_IP&user_agent=your_user_agent&currency=USD&value=10

 

open the link in your browser.

If everything is working as it should, you will receive a response with the following content:

{“code”: 0, “message”: “OK”, “request_id”: “202201311327480101131352331FD4A698”, “data”: {}}

and in a few minutes you will see a conversion in your TikTok dashboard.

The file also contains test_event_code lines that are commented out. While testing, you can uncomment them and insert your test_event_code in the S2S Postback from the pixel settings. But it is not necessary. You can use it if you need to run tests to configure other events.

Sometimes Binom sends the new IPv6 IP format while the affiliate program uses IPv4 format for conversion tracking. Don’t blame Binom for this. It’s just the tracker can process IPv6 traffic while some other platform can’t. In this case, I recommend sending IP conversions from the affiliate program to Binom via post-backs, and don’t forget to insert the corresponding token in S2S configuration.

 

This wraps up the process of sending events via the TikTok Events API.

 

Comments