Skip to content
Last updated

Tiktok Events Export Integration

This feature is in BETA version. For more information, contact your Customer Success Representative.

Overview

Many businesses are increasingly adopting TikTok as a key component of their advertising strategy. With over a billion active users, TikTok offers a vast audience and a unique, creative platform for brand promotion. Integrating event data with TikTok’s Events API can significantly enhance a brand’s advertising effectiveness and scale on the platform.

The native Tiktok Events Export connector for exporting event data to the TikTok Events API simplifies syncing event data to the TikTok Events Manager, driving data-driven audience targeting, and real-time insights for optimization.

This connector provides versatile data sync capabilities:

  • Website Event Data:
    • Enrich your website pixel data with server-side data.
    • Achieve more accurate audience targeting, enhancing your campaign’s effectiveness.
  • App Event Data:
    • Sync app event data with server-side data.
    • Improve targeting accuracy and optimize your campaign strategies for better results.
  • Offline Conversion Data:
    • Send offline conversion data, such as physical store visits, to the TikTok Events API.
    • Track and measure the impact of online ads on offline sales, allowing for more informed campaign adjustments.
  • CRM Lead Conversion Data:
    • Export CRM lead conversion data to TikTok Events API.
    • Enhance B2B lead generation campaigns by targeting users who have shown interest in your products or services, optimizing ad spend for higher quality leads.
  • Data Validation:
    • Ensure all event data is accurately formatted and validated according to TikTok’s specifications.
    • Streamline the data integration process, reducing the risk of errors and ensuring smooth data sync operations.

Prerequisites

  • Basic knowledge of Treasure Data, including the TD Toolbelt.
  • Basic knowledge of TikTok Business.
  • TikTok Access Token or TikTok Business account.

Limitations:

  • This connector can support creating new event source for Web Events and Offline Event source type only.
  • Experimental Event Source Types: App Event and CRM Event source types are experimental and not fully supported, as TD cannot enable these event sources for our test accounts. Please report any issues encountered with these event source types so that TD can address and fix them.

Static IP Address of Treasure Data Integration

If your security policy requires IP whitelisting, you must add Treasure Data's IP addresses to your allowlist to ensure a successful connection.

Please find the complete list of static IP addresses, organized by region, at the following link:
https://api-docs.treasuredata.com/en/overview/ip-addresses-integrations-result-workers/

Use the TD Console

Before running your query, you must create and configure the data connection in Treasure Data. As part of the data connection, you provide authentication to access the integration.

Create Authentication

Your first step is to create a new authentication with a set of credentials.

  1. Select Integrations Hub.
  2. Select Catalog.

  1. Search for your Integration in the Catalog; hover over the icon and select Create Authentication.

  1. Ensure that the Credentials tab is selected, and then enter credential information for the integration. Choose one of the following:
  • OAuth Authentication Workflow

Select the link "Click here" to start the OAuth authentication flow. After completing the authentication, a new OAuth connection will be created and available in the dropdown box

Select Continue to create a new connection.

  • Access Token Workflow

Obtain the access token from the TikTok Events Manager and input it in the TikTok Access Token field.

New Authentication Fields

ParameterDescription
auth_methodAuthentication method. Supported values: - oauth: OAuth authentication - access_token: Long live access token generated in the TikTok Event Manager.
access_tokenYou can obtain the TikTok Access Token from the TikTok Event Manager. This parameter is only available for access token authentication methods.
  1. Select Continue.
  2. Enter a name for your authentication, and select Done.

Define your Query

  1. Navigate to Data Workbench > Queries.
  2. Select New Query.
  3. Run the query to validate the result set.

Specify the Result Export Target

  1. Select Export Results.

You can select an existing authentication or create a new authentication for the external service to be used for output. Choose one of the following:

  • Use Existing Integration

  • Create a New Integration

The connection does not support creating a new connection in the result export. So, you need to have already created the connection.

Configuration guide

  1. Specifying the target event source in the Tiktok Event Managers for upload event data.

FieldDescription
Specify Event Data Source TypeSelect the type of TikTok event data source you are using. Supported event source types include:
  • Web Events
  • Mobile App Events
  • Offline Events
  • CRM Events
Specify The Target Event Source, Event Source ID, Event Source Name, Advertiser IDSelect the specific event source to upload event data to. The method you choose depends on the authentication method you use. Supported methods include:
  1. Use Event Source ID:
    • Authentication: Access token or OAuth authentication.
    • Instructions: Obtain the event source ID from the TikTok Events Manager:
      • Web Events: Pixel ID
      • Mobile App Events: TikTok App ID
      • Offline Events: Offline Event Set ID
      • CRM Events: CRM Event Set ID
      • Input: Fill in the "Event Source ID" input box. Leave the "Event Source Name" and "Advertiser ID" input boxes blank.
  2. Use Existing Event Source Name:
    • Authentication: OAuth authentication.
    • Supported for: Web Events and Offline Events.
    • Instructions: Query the existing event source name by filling in the "Event Source Name" and "Advertiser ID" input boxes. Ensure the "Event Source Name" is correct to query the right event source ID. Leave the "Event Source ID" blank.
  3. Create New Event Source Name:
    • Authentication: OAuth authentication.
    • Supported for: Web Events and Offline Events.
    • Instructions: Create a new event source name by filling in the "Event Source Name" and "Advertiser ID" input boxes. Note that only up to 10 event sources can be created for the Offline Event type.
  1. Other configuration options for data sync operations:

    FieldDescription
    Test Event CodeThe TikTok Test Event Code for debug purposes.
    Thread Count NumberNumber of parallel requests to TikTok Events. Min: 1, Max: 10, Default: 5.
    Enabled Limited Data ProcessingThe boolean value to enable/disable a limited data processing option. See Events API 2.0 - Limited Data Use for more details
    Skip on invalid record?The flag to continue or stop the job when the job handles an invalid record.

(Optional) Other configurations

  • You can create an activation in the Audience Studio to export segment data to this integration.
  • You can use Scheduled Job with Result Export to periodically upload data to a target destination.

(Optional) Export Integration Using the CLI

You can also use CLI(Toolbelt) to export results to TikTok Events.

You need to specify the information for export to your SFTP server as *--result option of td query* command. About td query command, you can refer to this article.

The format of the option is JSON and the general structure is as follows.

{
  "type": "tiktok_events",
  "auth_method": "oauth",
  "access_token": "78cdexxxen",
  "event_data_source": "WEB",
  "target_event_source_method": "NAME",
  "event_source_name": "Test",
  "advertiser_id": "7373xxx",
  "event_source_id": "CPUI2xxx",
  "test_event_code": "TESTXXX",
  "thread_count": 5,
  "limited_data_use": true,
  "skip_invalid_record": true
}

Parameters

NameDescriptionValueDefault ValueRequired
typeDescribe the name of the service as the destination of export.tiktok_eventsN/AYes
auth_methodAuthentication methodSupported values:
  • oauth - access_token
oauthYes
access_tokenTikTok access token generated from oauth flow or obtained from Events Manager.N/AN/AYes
event_data_sourceTikTok event data sources.Supported event sources:
  • WEB
  • APP
  • OFFLINE
  • CRM
WEBYes
target_event_sourceThe target event source method.Supported values: - ID - NAME - NEWIDYes
event_source_nameThe name of the event source. Input this field when the value of target_event_source is NAME or NEWN/AN/AYes, if the value of target_event_source is NAME or NEW
advertiser_idThe advertiser ID value. Input this field when the value of target_event_source is NAME or NEWN/AN/AYes, if the value of target_event_source is NAME or NEW
event_source_idThe event source id. Input this field when the value of target_event_source is ID
  • WEB: Using the Pixel ID
  • APP: Using TikTok App ID
  • OFFLINE: Using Offline Event Source ID
  • CRM: Using CRM Event Source ID
N/AYes, if the value of target_event_source is ID
test_event_codeThe TikTok test event code.N/AN/ANo
thread_countThe number of parallel requests to TikTok Events API.N/A5Yes
limited_data_useThe limited data use flag.true/falsefalseNo
skip_invalid_recordThe flag to continue or stop the job when handling the invalid record.true/falsefalseNo

Example for Usage

OAuth authentication

td query \
  --result '{
    "type": "tiktok_events",
    "auth_method": "oauth",
    "access_token": "373xxx",
    "event_data_source": "WEB",
    "target_event_source_method": "NAME",
    "event_source_name": "Test",
    "advertiser_id": "737xxx",
    "event_source_id": "738xxx",
    "thread_count": 5,
    "limited_data_use": false,
    "skip_invalid_record": false
  }' \
  -d sample_datasets \
  "SELECT * FROM www_access" \
  -T presto

Access token authentication

td query \
  --result '{
    "type": "tiktok_events",
    "auth_method": "access_token",
    "access_token": "373xxx",
    "event_data_source": "WEB",
    "target_event_source_method": "ID",
    "event_source_name": "Test",
    "advertiser_id": "737xxx",
    "event_source_id": "738xxx",
    "thread_count": 5,
    "limited_data_use": false,
    "skip_invalid_record": false
  }' \
  -d sample_datasets \
  "SELECT * FROM www_access" \
  -T presto

External references