Upload offline conversion events and see how many customers viewed or clicked on Facebook ads before converting.
For more general information about Facebook's offline conversions capabilities, see the Track Offline Conversions section of our Help Center.
To upload offline events directly through the Offline Conversions API, you will need the following:
The Offline Conversions API is part of the Facebook Marketing API. To access the Marketing APIs as a business, you will need the following:
To use any of the Marketing APIs, you must create and use a Facebook App. If you don't already have one, use the Create an Ads App button at the top of the Marketing API documentation.
If you are using Business Manager, you will then need to claim the app as a business.
Business Manager helps businesses and agencies manage their Facebook Pages, ad accounts, offline event sets, etc. in one place. It's highly recommended business integrations use an access token associated with a Business Manager instead of a personal user access token.
For this purpose, Business Manager has System Users that represent systems or software making calls to the Marketing APIs. To generate a System User and System User Access Token:
Business SettingsUsers > System UsersAdd New System UserAn access token provides access to Facebook APIs. To create system user access tokens:
Business SettingsUsers > System UsersGenerate New Tokenappscope select ads_management.If you are not using an admin system user, you need to explicitly grant your system user access to the relevant ad account:
Business SettingsUsers > System Users Assign Assets Create an Offline Event Set to upload offline events to. You need specific access to create offline event sets, assign to ad acocunts, and upload or view data for an event set. You must be:
ad_account connected to the offline event set.See Offline Conversion Event Set, Reference.
Create Offline Event Sets through Business Manager, or through a POST request:
curl
-F 'access_token=<SYSTEM_USER_ACCESS_TOKEN>' \
-F 'name=offline_event_set' \
-F 'description="conversion data used for superbowl campaign"'
https://graph.facebook.com/<API_VERSION>/<BUSINESS_MANAGER_ID>/offline_conversion_data_setsThe response includes the event set id:
{
"id": <OFFLINE_EVENT_SET_ID>
}Parameters:
| Parameter Name | Type | Description | Example |
|---|---|---|---|
|
| Event set name. |
|
|
| Event set description. |
|
To track which Facebook ads are associated with an offline conversion, the ads must have the appropriate Offline Event Set in their Tracking Spec. Unless this is properly configured, no ad attributions can be made.
You can set up auto-tracking per ad account in Business Manager, which will automatically set the tracking spec for any ad created in the ad account. Otherwise, you can set it per ad using the API via the following:
Assign tracking and read permissions to an ad account:
POST /<OFFLINE_EVENT_SET_ID>/adaccounts HTTP/1.1
Host: graph.facebook.comcurl -X POST \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/<OFFLINE_EVENT_SET_ID>/adaccountsParameters:
| Parameter Name | Type | Description |
|---|---|---|
|
| Assign ad account to this business ID. |
|
| ID of ad account with offline tracking enabled. |
Set ad tracking manually:
When you update a tracking_spec, we overwrite the previous one. Make sure to do a GET first, then append the associated String for the offline event set to the existing tracking_spec. For example, provide an appropriate tracking spec:
curl \
-F 'tracking_spec=[{action.type:"offline_conversion", dataset:["123"]}]' \
-F 'access_token=<SYSTEM_USER_ACCESS_TOKEN>' \
https://graph.facebook.com/<API_VERSION>/<AD_ID>Update your ads's tracking spec:
POST /<AD_ID>/?tracking_specs=[{"action.type":"offline_conversion","dataset": <OFFLINE_EVENT_SET_ID>}] HTTP/1.1
Host: graph.facebook.comcurl -X POST \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/<AD_ID>/?tracking_specs=[{"action.type":"offline_conversion","dataset": <OFFLINE_EVENT_SET_ID>}]Parameters:
| Parameter Name | Type | Description | Example |
|---|---|---|---|
|
| Track this action for the ad group. |
|
|
| ID for offline event set. |
|
You may backfill offline events up to 90 days in the past. However, since the maximum attribution window for Facebook is 28 days, backfilled data will only attribute properly up to 62 days in the past.

upload_tag: To help with debugging potential upload issues, we recommend passing the upload_tag parameter per event upload call. Use the same upload_tag to batch together all the uploads for a session, and a different upload_tag per upload session.Example Call:
curl \
-F 'access_token=<SYSTEM_USER_ACCESS_TOKEN>' \
-F 'upload_tag=store_data' \
-F 'data=[ \
{
match_keys: {"phone": ["<HASH>","<HASH>"], "email": ["<HASH>","<HASH>"]},
currency: "USD",
value: 16,
event_name: "Purchase",
event_time: 1456870902,
custom_data: {
event_source: "in_store"
},
},
{
match_keys: {"lead_id": "12345"},
event_name: "Lead",
event_time: 1446336000,
custom_data: {
event_source: "email",
action_type: "<sent|open|click>",
email_type: "<email_type_code>",
email_provider: "<gmail|yahoo|hotmail>",
}
},
]'
https://graph.facebook.com/<API_VERSION>/<OFFLINE_CONVERSION_DATA_SET_ID>/eventsSuccess response:
| Name | Type | Description |
|---|---|---|
| integer | Number of processed entries |
On error you see an exception returned with the invalid entries and the reasons. Fix the errors or skip the data rows with errors, and retry the API call.
Make an HTTP POST:
POST /<OFFLINE_CONVERSION_DATA_SET_ID>/events HTTP/1.1
Host: graph.facebook.comcurl -X POST \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/<OFFLINE_CONVERSION_DATA_SET_ID>/eventsWith the following parameters:
| Parameter Name | Type | Required Field | Description | Example |
|---|---|---|---|---|
|
|
| Track your event uploads. |
|
|
|
| See data parameters below. | See example |
|
|
| Scope used to resolve | 12345 |
data Parameters:| Parameter Name | Type | Required Field | Description | Example |
|---|---|---|---|---|
|
|
| Identifying information used to match transactions to Facebook Users. See match keys below. |
|
|
|
| The UNIX timestamp of the conversion event. |
|
|
|
| Event type. Must be one of nine Standard Events in Facebook Pixel. |
|
|
|
| Three-letter ISO currency for this conversion event. Required for |
|
|
|
| Value of conversion event. Required for |
|
|
|
| Any valid Dynamic Ad |
|
|
|
| List of product identifiers. |
|
|
|
| Information about this conversion event. |
|
match_keys are a set of identifiers to match people to Facebook Users for attribution. See Hashing and Normalization for Multi-Key for normalizing and hashing your match data. Only SHA256 hashing is supported, and the API does not accept unhashed data.
| Key type, Single and Multi | Key name | Hashing required |
|---|---|---|
Email Address(es) |
| YES |
Phone Number(s) |
| YES |
Gender |
| YES |
Date of Birth. YYYY format |
| YES |
Date of Birth. MM format |
| YES |
Date of Birth. DD format |
| YES |
Last Name |
| YES |
First Name |
| YES |
First Name Initial |
| YES |
City |
| YES |
US States |
| YES |
Zip codes |
| YES |
Country |
| YES |
Apple Advertising Identifier |
| YES |
Android Advertising ID |
| YES |
Third-party user id |
| Do NOT hash |
The lead id from Lead Ads |
| Do NOT hash |
The easiest way to check match rates and attributions as you develop and test your integration is through the 'Offline' section of the Events Manager, in your Business Manager.
For initial upload and user match testing, we recommend creating a test Event Set that is not tracked by any ads. Once ad attributions are made, they can not be removed.
A Business Manager Admin, or System User who created the offline event set, can retrieve upload stats. Any admin on the ad_account which is connected to the offline event set can also read this data.
To view stats about offline event sets such as valid entries and matched entries:
GET /<OFFLINE_EVENT_SET_ID>/uploads HTTP/1.1
Host: graph.facebook.comcurl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/<OFFLINE_EVENT_SET_ID>/uploadsView daily breakdowns of offline events in Events Manager. For more precise breakdowns, make this call:
GET /<OFFLINE_EVENT_SET_ID>/stats HTTP/1.1
Host: graph.facebook.comcurl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/<OFFLINE_EVENT_SET_ID>/statsParameters:
| Parameter Name | Type | Required Field | Description | Example |
|---|---|---|---|---|
|
|
| The unix timestamp. Query events starting at this time. |
|
|
|
| The unix timestamp. Exclude events occuring this time onward. |
|