Skip to main content
This guide shows you how to build an unattended integration that uploads conversion events to Narrative and sends them to a Meta dataset (pixel) through Meta’s Conversions API. The examples send offline events, such as in-store purchases. Before you start, complete the prerequisites and set up API access. You need a profile ID and the numeric ID of the Meta dataset, which List your Meta datasets returns.

1. Create the dataset

A conversion-event dataset needs two columns:
  • meta_conversion_event, an object holding the event
  • at least one identifier Meta can match on, such as sha256_hashed_email
Every event needs meta_dataset_id, event_id, event_name, event_timestamp, and source. The meta_conversion_event attribute lists the optional fields, such as source_url, data_processing_options, more custom_data fields, and store_data. Add the ones you use to the schema before you activate it, because activation locks the schema. Record the id in the response, then activate the dataset:

2. Confirm Meta accepts the dataset

Look for "app_id": 8 with conversion_events in the accepted list. If it is missing, the dataset lacks one of the two columns from step 1.

3. Get a test event code

Send test events first, so you can watch them arrive before they count as real conversions:
1

Open the dataset in Events Manager

In Meta Events Manager, open the dataset you are sending to and choose Test events.
2

Choose the channel

Select the Offline channel and expand Confirm your server’s events are set up correctly.
3

Copy the code

Copy the test event code Meta shows, which starts with TEST. Keep the tab open while you test.

4. Create the connection

The connection names no Meta dataset. Each event names its own in meta_dataset_id, so one connection can send to every Meta dataset the profile can reach. historical_data_enabled set to true sends the events already in the dataset as well as new ones. Set it to false to send only events written after the connection exists.

5. Upload events

Each line of the file is one event. event_name takes the lowercase names listed in Event names, such as purchase. Offline events use physical_store as source.
Upload and ingest the file the same way as an audience file (see Upload and ingest your file):

6. Check the events at Meta

Watch the Test events tab you left open. Within a few minutes each event appears with its event name (for example Purchase), status Processed, and Server as where it was received from. Expand an event to see its value, currency, order_id, action source, and the user data keys Meta matched on, such as Email. To hear about deliveries in your integration, subscribe to delivery notifications.

Going live

When the test events look right, send real conversions:
  1. Create a connection on the dataset with the same request as step 4, leaving out test_event_code.
  2. Delete the test connection with DELETE /v2/connections/{connection_id}.
Events sent through the new connection count as real conversions.

Keeping events flowing

Write new events to the dataset. The connection keeps running, so new rows reach Meta without further calls. Meta accepts offline events up to 90 days old and other events up to 7 days old. See Event age limits.

Stopping delivery

Deleting the connection archives it and stops further events from reaching Meta.

Troubleshooting

Getting help

Contact your Narrative relationship manager with your company ID, the dataset ID, and the failing request and response.

Delivering Custom Audiences via the API

Deliver hashed identifiers into a Custom Audience

Meta Conversions API Connector

Every meta_conversion_event field, event name, and action source

Connector Interfaces

Why a dataset connects to an interface rather than a connector

API Keys

Create and rotate keys for programmatic access