Need to use the TikTok server-to-server API to track conversions? Got you covered.

Our SaaS, FunnelFlux Pro, has an integration to accommodate this and as a FunnelFlux user, you can use it too! However, note it may not be as complete.

Here's what you need:

  1. A TikTok account, obviously

  2. A pixel and its ID

  3. A few minutes of spare time


Step 1 - Generate an Access Token

Firstly you will need to generate an access token that allows our TikTok conversion API app to access your account and its pixels.

Log into TikTok (the account with the pixels you want to use), then load this URL in your browser > CLICK ME

This should take you to an authentication screen like so:

Tick the agree checkbox and click the confirm box.

Wait a few seconds as it will redirect to one of our URLs that will provide you with your access token to the account.

After a few seconds you should see a page with content like this:

Copy this Access Token value to a text editor. If you ever lose it, you can just go through the steps above to regenerate one.


Step 2 - Set up TikTok as a Traffic Source in FunnelFlux

In FunnelFlux, go to the traffic sources page and create a new one.

For the tracking fields, there is only one we need to capture -- the click ID or "ttclid".

Now, in the conversion tracking part, choose postback URL.

Here we have to create quite a large postback URL, so I suggest copying the content below to a text editor where you can carefully edit it, and once done, remove the line breaks for the last three lines to make a single-line URL.

https://us-central1-helper-cloud-functions.cloudfunctions.net/tiktok-s2s-api
?vid={flux_hid}&ttclid={trackingfield_ttclid}&currency=USD&revenue={flux_payout}&ip={connection-ip}&user_agent={connection-useragent}&page_url={page-url}
&access_token=YOUR_ACCESS_TOKEN
&pixel_id=PIXEL_ID
&event_name=EVENT_NAME

In the above parameters, you need to:

  • Replace YOUR_ACCESS_TOKEN with the value you got earlier

  • Replace PIXEL_ID with your pixel ID from the TikTok UI

  • Replace EVENT_NAME with a valid event name (see below)

  • Lastly, collapse it all down into a single line by removing the line breaks, then copy/paste this into the postback URL box

NOTE: make sure to remove the line breaks. If you paste as is, it might look OK in the FunnelFlux UI, but you will have extra characters in the URL that will break it.

The TikTok standard events are documented here (use the table of contents on the right-hand side).

These are the available event names as of writing:

ViewContent
ClickButton
Search
AddToWishlist
AddToCart
InitiateCheckout
AddPaymentInfo
CompletePayment
PlaceOrder
Contact
Download
SubmitForm
CompleteRegistration
Subscribe

We automatically pass the revenue value from your conversion and a currency value of USD.

And that's it! You should now track TikTok events via S2S.

Did this answer your question?