Skip to main content

Implement TikTok Events API Program via ATS for Web

You can integrate your ATS for Web configuration with the TikTok Events API Program for Online Conversions to easily collect event data and send it to TikTok. Make sure you have fulfilled the requirements for setting up the TikTok Events API before you get started.

Once you have added the required information, you can now set up the type of events that you want to send to TikTok.

Set Up ATS for Web to Send Event Data to TikTok

The procedure below is a direct continuation of the steps from Set Up TikTok CAPI Integration in Console .

Note

Make sure to first-party cookies from TikTok in the same domain where ATS for Web is running.

  1. After providing the TikTok ad account ID and authentication token, you can now specify the events you want to send to TikTok. Under ‘Events List’, click Create New.

    TikTok_create_Event.png
  2. Enter an Event Name.

  3. Select the Event Type to determine which event you want to send to TikTok. This list is predefined by TikTok.

  4. (Optional) If your website is leveraging data layer run by Google Tag Manager or Adobe Analytics, you can enable Data Layer Detection. If you enable this option, all parameters in this event will be obtained through data layer detection by default.

    Data_Layer_Snap.png

    Note

    The data layer detection functionality currently supports data layer run Google Tag Manager and Adobe Analytics. To learn more, see Google's article "The data layer" or Adobe's article "Create a data layer".

    After enabling this feature, call the ats.detectDataLayerEvents() function when you know the event data have been stored on data layer. Make sure to call the function on every single page where you want ATS.js to detect the event.

  5. In the "Event Deduplication" section, select how the Event ID should be obtained, and for which identifier. The Event ID is used to eliminate duplicate events by assigning a unique identifier to each event. In the example below, we are using the order number as the Event ID.

    Tiktok_capi_eventdedup.png

    Note

    • CSS selector allows you to obtain the parameter by targeting a specific HTML element in your page. We recommend using only ID selector to limit errors. For example; #product-value, #ItemValue

    • Alternatively, you can provide a URL parameter which is added at the end of a URL after the ‘?’ symbol. For example; currency, product-currency

    • If you want to pass predefined values, you can also select Hardcoded Values and enter a value you want to pass for the parameter. For example, if the transactions in your website are always in US dollars, you may want to set the value to "USD" for the Currency parameter

  6. If you selected the Complete Payment event type, you must provide additional parameters under "Required Custom Data" for the currency and value. Select URL or CSS Selector for each parameter and provide the required data to define where the related information could be obtained.

    Tiktok_capi_requireddata.png
  7. In the "Custom Data" section, enable Add Custom Data Parameters to add additional custom parameters defined by TikTok. We recommend you select as many parameters as you already have on your website. The more parameters you add, the more accurate the data TikTok will receive.

    The following parameters are available to select from:

    • Content Type

    • Query

    • Description

    • Order ID

    • Shop ID

    Tip

    You can add more parameters by clicking the plus button and remove them by clicking the minus button.

    Pinterest_Plus_Minus.png
  8. Set up the Trigger event to decide when the events should be sent. You can select Automatically to have it sent every time the event happens, or Manually by creating an API call when all event data are available on the page.

    • Automatically (recommended): Events are automatically sent at the end of each user session. This can be either when the user closes the page or switches tabs.

    • Manually: You trigger the JavaScript function when you know all information is obtained. To do this, call ats.sendTiktokEvents(['name_of_event']) and replace 'name_of_event' with the event name you provided in step 2.

    Note

    For non-checkout events such as "Add To Cart", "Subscribe", and others, we recommend setting up a trigger event only on some pages to make sure they are not fired on every page load.

  9. Specify to have the trigger added to all pages by selecting Always, or in specific pages by selecting On some pages. If you choose the latter, you must provide the page URL and a domain identifier to specify when the module should start detection to obtain all conversion data from the page. Click the plus button to add multiple pages.

    Pinterest_Trigger__Event.png
  10. Click Save.

Once you are done with setting up the events, the TikTok Events API will collect and send the event data to TikTok whenever the specified events occur on your website. All the captured conversion events should be visible in TikTok Events Manager where you can manage and view event data.