> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Send PostHog conversion events to TikTok Ads Canonical URL: https://posthog.com/docs/data-pipelines/destinations/tiktok-ads > **Cloud region:** This page uses US Cloud hosts. For an EU Cloud project, use `https://eu.i.posthog.com` instead of `https://us.i.posthog.com` (ingestion host), and use `https://eu.posthog.com` instead of `https://us.posthog.com` or `https://app.posthog.com` (app host for links). ## On this page - [Installation](#installation) - [Configuration](#configuration) - [FAQ](#faq) You should be aware that this destination relies on creating third-party cookies. You'll also need access to the relevant TikTok Ads account. ## Installation 1. In PostHog, click the [Data pipeline](https://app.posthog.com/data-management/destinations) tab in the left sidebar. 2. Click the [Destinations](https://app.posthog.com/data-management/destinations?search=tiktok) tab. 3. Search for **TikTok Ads Conversions** and click **\+ Create**. 4. Visit the [TikTok Events Manager](https://ads.tiktok.com/i18n/events_manager/home). 1. If you’ve already set up a Pixel for your website, we recommend that you use the same Pixel for your browser and server events. 1. To create a new Pixel, click **Connect data source** and select **Web**. 2. Skip the **Add your website** step. 3. For the connection method, select **Manual setup** and **Events API**. 4. Enter a name for your Pixel and click **Create**. 2. Go to your Pixel via **Data sources**. 3. Switch to the **Settings** tab and your Pixel ID will be listed as **ID**. 4. You can create an access token by clicking **Generate Access Token**. 5. Back in PostHog, add the Pixel ID and Access token to the destination configuration. 6. Set up your event and property filters to remove unnecessary events. You only want to send events that are conversions. Filter out unrelated events or ones missing required data. 7. Press **Create & enable**, test your destination, and then watch your conversions get sent to TikTok Ads. ## Configuration | Option | Description | | --- | --- | | `Access token` **Type:** string **Required:** True | Check out this page on how to obtain such a token: [https://business-api.tiktok.com/portal/docs?id=1771101027431425](https://business-api.tiktok.com/portal/docs?id=1771101027431425) | | `Pixel ID` **Type:** string **Required:** True | You must obtain a Pixel ID to use the Conversions API. If you've already set up a Pixel for your website, we recommend that you use the same Pixel ID for your browser and server events. | | `User properties` **Type:** dictionary **Required:** True | A map that contains customer information data. See this page for options: [https://business-api.tiktok.com/portal/docs?id=1771101151059969#item-link-user%20parameters](https://business-api.tiktok.com/portal/docs?id=1771101151059969#item-link-user%20parameters) | | `Test Event Code` **Type:** string **Required:** False | Use this field to specify that events should be test events rather than actual traffic. You'll want to remove your Test Event Code when sending real traffic through this integration. | How to create this via the API Using our REST API you can create this destination like so: ```bash # Create a new destination curl --location 'https://us.i.posthog.com/api/environments/:project_id/hog_functions' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data '{ "type": "destination", "name": "TikTok Ads Conversions", "inputs": { "accessToken": { "value": "" }, "pixelId": { "value": "" }, "userProperties": { "value": { "ip": "{event.properties.$ip}", "city": "{not empty(person.properties.$geoip_city_name) ? replaceAll(lower(person.properties.$geoip_city_name), ' ', '') : null}", "email": "{not empty(person.properties.email) ? sha256Hex(lower(person.properties.email)) : ''}", "phone": "{not empty(person.properties.phone) ? sha256Hex(person.properties.phone) : ''}", "state": "{lower(person.properties.$geoip_subdivision_1_code)}", "ttclid": "{person.properties.ttclid ?? person.properties.$initial_ttclid}", "country": "{lower(person.properties.$geoip_country_code)}", "zip_code": "{not empty (person.properties.$geoip_postal_code) ? sha256Hex(replaceAll(lower(person.properties.$geoip_postal_code), ' ', '')) : null}", "last_name": "{not empty(person.properties.last_name) ? sha256Hex(lower(person.properties.last_name)) : ''}", "first_name": "{not empty(person.properties.first_name) ? sha256Hex(lower(person.properties.first_name)) : ''}", "user_agent": "{event.properties.$raw_user_agent}", "external_id": "{not empty(person.id) ? sha256Hex(person.id) : ''}" } } }, "enabled": true, "template_id": "template-tiktok-ads" }' ``` ## FAQ ### Why is person data missing from my ad destination events? Ad destinations filter the realtime event stream. This means they use person data as it exists at the exact moment the event is processed, not data added later. A common issue occurs when a backend event triggers the destination, but person properties are set by a frontend `identify` call that happens afterward. If the identify call merges with the person *after* the trigger event is processed, the destination won't have access to that data. To fix this, either: 1. **Include the data directly in the event** that triggers the destination (e.g., pass email, phone, or other required properties as event properties) 2. **Ensure the identify call happens before** the events you want to send to the ad platform ### Is the source code for this destination available? PostHog is open-source and so are all the destination on the platform. The [source code](https://github.com/PostHog/posthog/blob/master/nodejs/src/cdp/templates/_destinations/tiktok_ads/tiktok.template.ts) is available on GitHub. ### Who maintains this? This is maintained by PostHog. If you have issues with it not functioning as intended, please [let us know](https://us.posthog.com/#panel=support%3Asupport%3Aapps%3A%3Atrue)! ### What if I have feedback on this destination? We love feature requests and feedback. Please [tell us what you think](https://us.posthog.com/#panel=support%3Afeedback%3Aapps%3Alow%3Atrue). ### What if my question isn't answered above? We love answering questions. Ask us anything via [our community forum](https://posthog.com/questions.md).