TikTok Ads Destination Config Reference
- free
- growth
- enterprise
7 minute read
TikTok Ads is an advertising destination. RudderStack sends conversion events to TikTok’s Events API from its servers, or loads the TikTok pixel in the browser in device mode.
In a TikTok Ads destination spec:
type: tiktok_adsdefinition_version: 1
Sample configuration
version: rudder/v1
kind: destination
metadata:
name: tiktok-ads-prod
spec:
id: tiktok-ads-prod
display_name: TikTok Ads Production
type: tiktok_ads
definition_version: 1
enabled: true
config:
pixel_code: "{{ .TIKTOK_PIXEL_CODE }}"
access_token: "{{ .TIKTOK_ACCESS_TOKEN }}"
version: v2
hash_user_properties: true
events_to_standard:
- from: Order Completed
to: CompletePayment
- from: Product Added
to: AddToCart
send_custom_events: false
event_filtering:
whitelist:
- Order Completed
- Product Added
connection_mode:
web: device
cloud: cloud
consent_management:
web:
- provider: oneTrust
consents:
- marketingThe above example loads the TikTok pixel on web sources in device mode and sends server-side events in cloud mode. event_filtering affects only the device-mode web traffic — see Event filtering.
Config keys
config accepts only the keys listed below. The shared config key rules cover unknown keys, defaults, and immutability.
Incloudmode TikTok Ads accepts onlytrackevents. Indevicemode, web sources also sendidentifyandpage.
Connection
pixel_code
RequiredSecretType:
string
Description: Code of the TikTok pixel that receives the events. Used in both modes.
Notes:
- At most 100 characters, and must not contain line breaks.
- A
{{ path || fallback }}template is accepted in place of a literal.
access_token
SecretType:
string
Description: TikTok long-term access token for the Events API. Cloud mode needs it; device mode doesn’t.
Notes:
- Rudder CLI doesn’t require this key, even when a source connects in
cloudmode. Without it, cloud-mode delivery fails at TikTok.
{{ .VAR }} reference rather than a literal — see Secrets.version
Type:
string
Default value:
v2
Description: TikTok Events API version for cloud mode.
Notes:
v2orv1. Usev2— TikTok announced the sunset of Events API 1.0.- A
{{ path || fallback }}template is accepted in place of a literal.
hash_user_properties
Type:
boolean
Default value:
true
Description:
SHA-256 hash contextual user properties such as external_id, email, and phone_number before sending them.
Notes:
- Applies to
cloudmode only.
Event mapping
events_to_standard
Type:
array of objects
Description: Maps RudderStack event names to TikTok standard events. Events without a mapping follow the default mapping in Event mapping.
Notes:
from— RudderStack event name. At most 100 characters, and must not contain line breaks.to— one ofAddPaymentInfo,AddToCart,AddToWishlist,ClickButton,CompletePayment,CompleteRegistration,Contact,Download,InitiateCheckout,PlaceAnOrder,Search,SubmitForm,Subscribe,ViewContent,CustomizeProduct,FindLocation,Schedule,Purchase,Lead,ApplicationApproval,SubmitApplication, orStartTrial.- Both fields accept a
{{ path || fallback }}template in place of a literal.
events_to_standard:
- from: Order Completed
to: CompletePaymentsend_custom_events
Type:
boolean
Default value:
false
Description: Send events that don’t map to a standard event as TikTok custom events. For custom events, only TikTok’s standard fields are sent; other fields are dropped.
Event filtering
Client-side event filtering is applied by the RudderStack SDK, so it affects only web sources connected indevicemode. Events sent incloudmode reach TikTok unfiltered, whatever this block says.
event_filtering
Type:
object
Description:
Restricts which track events the SDK passes to the TikTok pixel, by event name.
Notes:
whitelist— array of event names to allow; every othertrackevent is dropped.blacklist— array of event names to drop; every othertrackevent is allowed.- The two are mutually exclusive, and Rudder CLI enforces it — setting both fails validation.
- Each name is at most 100 characters, or a
{{ path || fallback }}template. - Omit the block entirely to filter nothing.
event_filtering:
blacklist:
- Product ViewedPer-source keys
Both keys are objects keyed by the local source type — the tokens listed under Source types. A key naming a source type this destination doesn’t support fails validation.
connection_mode
Type:
object
Description: Maps each source type you connect to the mode its events reach TikTok in, using the modes in Source types.
Notes:
- An entry is required for each source type you connect — see Connect a source.
- A mode the source type doesn’t support on this destination fails validation — for example
deviceforandroid.
connection_mode:
web: device
cloud: cloudconsent_management
Type:
object
Description:
Consent provider configuration per source type. The entry shape, accepted providers, and the rules on resolution_strategy and consents are shared across all destination types — see Consent management.
Source types
TikTok Ads accepts events from these source types in the mentioned connection modes:
| Source type | Connection mode |
|---|---|
android | cloud |
android_kotlin | cloud |
ios | cloud |
ios_swift | cloud |
web | cloud, device |
unity | cloud |
react_native | cloud |
flutter | cloud |
cordova | cloud |
cloud | cloud |
warehouse | cloud |
Only web offers device mode, which loads the TikTok pixel in the browser. See TikTok Ads device mode and RudderStack Connection Modes.
warehouse is the token a Reverse ETL source resolves to. Rudder CLI manages the destination’s warehouse entry — if the destination is connected to a Reverse ETL source, set connection_mode.warehouse: cloud in its spec, or apply removes it.
Rudder CLI can also declare the Reverse ETL connection itself, for the types listed under Supported destinations — see Manage Reverse ETL Connections using Rudder CLI.
The dashboard additionally offers TikTok Ads to AMP and Shopify sources. Rudder CLI doesn’t manage those connections, soampandshopifyare invalid here.
Connect a source
An event stream connection to this destination is checked against two rules at validate time.
The source’s type must be supported. A source’s type resolves to one of the tokens above before the check — a JavaScript source resolves to web, and webhook and server-side SDK sources resolve to cloud. Every type an event stream source can resolve to is supported here, so this check always passes.
The destination config must carry a connection_mode entry for that source type. This lives on the destination spec, not on the connection spec. Without it:
destination 'tiktok-ads-prod' config has no 'connection_mode' entry for source type 'web'TikTok Ads needs no additional config keys to connect a source of any type, in any mode.
Secrets
pixel_code and access_token are the secret keys. Write each as a {{ .VAR }} reference and supply the value at apply time:
config:
pixel_code: "{{ .TIKTOK_PIXEL_CODE }}"
access_token: "{{ .TIKTOK_ACCESS_TOKEN }}"export RUDDER_TIKTOK_PIXEL_CODE="..."
export RUDDER_TIKTOK_ACCESS_TOKEN="..."
rudder-cli apply
# or
rudder-cli apply --var-file secrets.vars.yamlNote that:
rudder-cli importwrites only the secrets the API returns, as{{ .VAR }}references, and leaves the others out. Add any secret key it leaves out, then supply the variables before you apply — see Secrets.- In device mode the pixel code is embedded in the page’s JavaScript, so treating it as a secret protects your YAML, not the value itself.
See How to Use Variable Substitution in Rudder CLI.
Changes by release
| Version | Change |
|---|---|
| v0.29.0 | Breaking: A null config value, written as key: null, key: ~, or key: with no value, fails validate with '<key>' must not be null; set a value or remove the key. Earlier releases accepted it: a top-level null planned an update on every apply, and a null inside a list item failed at the API.What to do: Remove the key to leave it unset, or give it a value. |
| v0.29.0 | Breaking: An empty string, "", on a key that takes one of a fixed set of values fails validate with '<key>' must be one of [...], unless "" is one of the key’s values. Earlier releases accepted it, and the API rejected it at apply.What to do: Remove the key to leave it unset, or set one of the listed values. |
| v0.29.0 | Changed: validate warns when a secret key holds anything but one {{ .VAR }} reference with no default, and when one variable fills two secret keys. It also masks secret values in the lines it prints. |
| v0.29.0 | Changed: rudder-cli import writes each secret reference single-quoted, as '{{ .VAR }}', so a value containing double quotes, like a JSON key file, substitutes as a string. A single quote in a value that fills such a reference is written as ''.What to do: In a spec imported by an earlier release, quote each reference to a JSON value by hand: '{{ .VAR }}'. |
| v0.29.0 | Changed: validate reports a value of the wrong type once per key, such as 'email' must be a string, instead of one raw decoding error. |
| v0.28.0 | Added: warehouse source type, for destinations connected to a Reverse ETL source. Set connection_mode.warehouse: cloud for such a destination, or apply removes the entry. |
For changes across every destination type, see Destination Type Changes by Release.
See more
- TikTok Ads Destination for pixel setup and verifying delivery
- Destination Type Reference for Rudder CLI for the rules shared across destination types
- Destination YAML Reference for the spec envelope