Send offline events to TikTok Ads Manager¶
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?
Offline events must have occurred within the previous 28 days. The maximum attribution windows for
Click-through attribution (CTA) is 28 days
View-through attribution (VTA) is 7 days
Offline events beyond these attribution windows are not matched to ads or displayed in reporting.
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.
Build a query¶
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
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. |