Skip to content
Last updated

Facebook Conversions Export Integration CLI

You can use the Facebook Conversions BETA to send job results (in the form of 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.

This topic contains:

Prerequisites

  • Basic Knowledge of Treasure Data.

  • Basic knowledge of Facebook Conversions and Facebook Event

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

    • Business Manager admin
    • Admin system user who created the event set
    • Admin on the ad_account connected to the 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_conversions
access_tokenstringYesA long-lived access token
pixel_idstringNoFacebook Pixel ID
test_event_codestringYesFacebook event set ID
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...

Example: Query and export results to an Event set

td query --database my_db \
--result '{"type": "facebook_conversions","access_token": "xxx","pixel_id": "yyy","test_event_code": "361738844830373", "skip_invalid": true}'\
'SELECT event_name, event_time, email as em from your_table'

Learn about supported query column names.

Scheduling Execution

Make sure to review: