Send query results to TikTok Ads Manager¶
Use queries to build high-value audiences for retargeting and lookalike modeling, and then use orchestrations to send those audiences to TikTok Ads from Amperity. Marketers can use their best customers as a seed set for acquisition, which leads to improved match rates, stronger ROI, reduced onboarding costs, and stronger net new customer conversion.
Tip
Start with a balanced and stable audience. Allow that audience to complete its learning phase , which is a process TikTok Ads uses to optimize ad delivery for your audience.
Keep your audience stable during the learning phase and only make adjustments if your audience does not look like it will complete the learning phase, which typically ends after ~50 conversions.
Caution
To refresh audiences from Amperity, new one-time segment deliveries need to be created and uploaded to the client’s TikTok account.
Note
Amperity uses a combination of endpoints in the TikTok Ads Segment API to verify existing segments , add or update the list of customers to match the list of customers sent from Amperity, and then map multiple advertising account IDs to the same business account .
Changes to audience mapping are not immediately available in TikTok Ads. Allow for up to 10 hours after the point at which Amperity has finished sending audience updates for them to be available.
Important
Amperity requires access to TikTok Ads. This access may expire or be removed periodically, depending on how OAuth is managed at TikTok Ads. If Amperity is unable to send data to TikTok Ads ask your DataGrid Operator to reauthorize access to TikTok Ads.
This topic describes the steps that are required to send email addresses, phone numbers, and advertising IDs (IDFAs for iOS devices or AAIDs for Android devices) to TikTok Ads from Amperity:
Note
TikTok Ads must be enabled before you can configure an orchestration to send query results.
Build query¶
You will need to build a query that outputs email addresses and phone numbers.
Tip
Email addresses most often lead to the best match rates!
You may include, in addition to email addresses and phone numbers, mobile advertiser IDs (MAIDs) if they are available. Associate the MAIDs for Apple devices to IDFA and MAIDs for Google Android devices to AAID.
Example
SELECT
email AS EMAIL
,CONCAT('+',REGEXP_REPLACE(phone, '(\s*)([^a-zA-Z0-9])', '')) AS PHONE
FROM Customer360
WHERE email IS NOT NULL
OR phone IS NOT NULL
Send offline events¶
Send offline events to TikTok Ads to help your brand track offline conversions that result from your marketing campaigns. Support for offline events and parameters is part of the TikTok Events API.
For example: When did a customer purchase? What did a customer purchase? Was it from a store or a website? How many items were purchased? Was there more than one purchase? What was the total revenue for each purchase?
Note
Offline events are not immediately available in TikTok Ads. Allow for up to 24 hours after the point at which Amperity has finished sending offline events for them to be available.
Use a query to build a combination of data from the your brand’s customer 360 database to represent the set of offline events that your brand wants to use within TikTok Ads. A query that collects offline events for use in TikTok Ads is similar to:
SELECT
'ACME Essentials' AS brand
,uit.product_category AS content_category
,uit.product_id AS content_id
,uit.product_name AS content_name
,'product' AS content_type
,'USD' AS currency
,TO_HEX(SHA256(TO_UTF8(LOWER(TRIM(mc.email))))) AS emails
,'CompletePayment' AS event
,'website' AS event_channel
,uit.order_id AS event_id
,'7654321098765432109' AS event_set_id
,uit.order_id
,CONCAT('+1','',REGEXP_REPLACE(mc.phone,'[$\D\s]','')) AS phone
,uit.item_price AS price
,uit.item_quantity AS quantity
,uit.store_id AS shop_id
,uit.order_datetime AS timestamp
,CAST(uit.item_revenue / uit.item_quantity AS DOUBLE) AS value
FROM Unified_Itemized_Transactions uit
LEFT JOIN Merged_Customers mc ON uit.amperity_id = mc.amperity_id
WHERE uit.order_datetime > (CURRENT_DATE - interval '7' day)
and MUST contain the following fields: emails, event, event_id, and event_set_id. Review the list of supported offline events parameters while building the query.
Fields that contain PII – emails and phone_numbers, for example – should have one-way SHA-256 hashing applied to them.
Note
Currency must be in ISO 4217. For example: “EUR”, “USD”, or “JPY”.
Note
The phone number must be in e164 format. If your customer 360 database is not already standardized for e164 format, use the following line instead of ,c360.phone AS phone:
,CONCAT('+1','',REGEXP_REPLACE(mc.phone,'[$\D\s]','')) AS phone_numbers
Add orchestration¶
An orchestration defines the relationship between query results and a destination, including the location to which those query results will be sent and the frequency at which the orchestration will be run.
To add an orchestration
From the Destinations tab, click Add Orchestration. This opens the Add Orchestration dialog box.
From the Object Type drop-down, select Query.
From the Object drop-down, select the query for which results will be sent to TikTok Ads.
From the Destination drop-down, select a destination that is configured for sending data to TikTok Ads.
From the Data Template drop-down, select a data template.
Verify all settings.
Set the workflow to Manual. (You can change this to automatic later, after verifying the end-to-end workflow.)
Click Save.
Run orchestration¶
Run the orchestration manually to validate that it works.
To run the orchestration
From the Destinations tab, under Orchestrations, open the menu for the TikTok Ads orchestration, and then select Run.
The Status column for the orchestration will update to say “Waiting to start…”, after which the notifications pane will update to include a notification that shows the current status.
When the orchestration has run successfully, the status is updated to “Completed”.
Offline events parameters¶
The following table describes each of the parameters that are required by TikTok Ads for offline events.
The fields are listed alphabetically, but may be returned by a query in any order.
Field name |
Description |
---|---|
agent |
Web events only. A non-hashed user agent from the user’s device. This field should be sent along with ip when both are available. (Amperity renames this field to “(user_agent)” when events are sent to TikTok Ads Manager.) |
brand |
The brand name of the product item. |
content_category |
A product category. |
content_id |
A product identifier. |
content_name |
The name of a product. |
content_type |
A product or product type. |
cookie_id |
Web events only. A unique ID that matches website visitor events with ads on TikTok. (Amperity renames this field to “(ttp)” when events are sent to TikTok Ads Manager.) |
currency |
The ISO 4217 code for the currency that is associated with the offline event. For example: “USD”. |
Required. The email associated with the order. The email address that is associated with a customer. A customer may have more than one email address. |
|
event |
Required The type of offline event. Add event to your query and then set a value: ,event AS 'CompletePayment'
Important The value for event must be one of the supported offline event types defined by TikTok Ads. A partial list of event types—ones that are more likely to align to your Amperity use cases—is described in the following table. The value for event must be one of the following:
The value for event is used to categorize offline conversions within the TikTok Ads user interface and may not be customized. Use the event type that best associates how your brand wants to use offline events within TikTok Ads. |
event_channel |
The event channel type. Must be one of the following values: email, website, phone_call, in_store, crm, or other. |
event_id |
Required. The unique identifier for the offline event. TikTok Ads recommends that the value for event_id be a string of 32 characters that includes any combination of numeric digits (0-9), uppercase letters (A-Z), and lowercase letters (a-z). |
event_set_id |
Required. The event set ID. (The event set must exist before you can send data to it from Amperity.) An event set ID is a nineteen character string similar to “7654321098765432109”. You can find the event set ID from the TikTok Ads user interface. Click Assets, then Events, and then from the Offline box select Manage. Each event set will have its own card; the event set ID is located under the name of the event set. |
event_source |
The type of event to be uploaded to TikTok Ads Manager. May be one of “web” or “offline”. Use “web” for events that took place on your website and were collected using the payload helper . Use “offline” for events that took place in a physical store and are measured by an offline event set ID. |
ip |
Web events only. A non-hashed public IP address for the user’s device. May be an IPv4 or an IPv6 address, full or compressed. This field should be sent along with agent when both are available. |
order_id |
The unique ID for a transaction. |
phone |
Recommended. The phone number that is associated with a customer. A customer may have more than one phone number. Note A phone number must be in E.164 format, which represents a phone number as a number up to fifteen digits in length (without spaces) that starts with a + symbol. For example: +12061234567. |
price |
The price of a product or service. |
quantity |
The number of items associated with an offline event. |
shop_id |
The unique ID for a physical store location or for your brand’s website. |
tiktok_click_id |
Web events only. A parameter that is appended to a landing page URL whenever a user clicks on an ad in TikTok. (Amperity renames this field to “ttclid” when events are sent to TikTok Ads Manager.) |
timestamp |
The date and time at which the offline event occurred. The timestamp should use ISO 8601 formatting. |
value |
The value associated with the offline event. Note This value is required for revenue reports within TikTok Ads. |