Skip to content
Last updated

Facebook Offline Conversions Export Integration CLI

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

You can use the Facebook Offline Conversions BETA to send job results (in the form of offline event data) from Treasure Data directly to Facebook to measure how much your Facebook ads lead to real-world outcomes, such as purchases in your stores, phone orders, bookings, and more.

Prerequisites

  • Basic Knowledge of Treasure Data.

  • Basic knowledge of Facebook Offline Conversions and Facebook Offline Event

  • To upload event data, you need access to one of the following on Facebook:

    • Business Manager admin
    • Admin system user who created the offline event set
    • Admin on the ad_account connected to the offline event set

Creating Your Connection from the Command Line

You can use the CLI to configure your connection.

td query --database your_database --result configuration query

The following table identifies the configuration keys with descriptions.

Config KeyTypeRequiredDescription
typestringyesfacebook_offline_conversions
access_tokenstringYesA system user or long-lived access token
app_secretstringNoFacebook app secret
event_set_idlongYesFacebook offline event set ID.
upload_tagstringYesUse to track your event uploads
match_keysstringYesThe identifying information used to match people on Facebook. The value is a comma-separated string. Example: email,phone,fn,ln,st,country…
namespace_idlongNoScope used to resolve extern_id or tpid. Can be another data set or data partner ID. Example: 12345
skip_invalidbooleanNoUse to terminate job (without revert) when invalid records are encountered. For example, a record is missing the required columns e.g. event_name, event_time...
retry_limitintNoMaximum retry times for each API call. Default: 6
initial_retry_wait_msecslongNoWait time for the first retry. Default: 60000 milliseconds
max_retry_wait_msecslongNoMaximum time between retries. Default:30000 milliseconds
connection_timeout_secslongNoThe amount of time before the connection times out when doing API calls. Default: 300 seconds
write_timeout_secslongNoThe amount of time waiting for writing data into the request. Default: 180
read_timeout_secslongNoThe amount of time waiting for reading data from the response. Default: 60

Example: Query and export results to an Offline event set

td query --database my_db \
--result '{
           "type": "facebook_offline_conversions",
           "access_token": "xxx"
           "app_secret": "yyy"
           "event_set_id: 361738844830373,
           "upload_tag": "store_data"
         }' \
'SELECT email, fn, ln, event_time, event_name, value, currency from your_table'

Learn about supported query column names.

Scheduling Execution

Make sure to review: