Documentation sections

Facebook Conversions API

The tracker sends Lead and Purchase events to Facebook on its own when an affiliate network sends a conversion.

The Facebook Conversions API is turned on in the source card: for conversions with the lead or sale status from this source's clicks, the tracker sends an event to Facebook from your server. You will need a Pixel ID and an Access Token. The owner and the admin can change the source card.

Turning it on in a source

  1. Open Sources («Источники»).
  2. Select the source that sends traffic from Facebook.
  3. Check the Facebook Conversions API checkbox. The Pixel ID and Access Token fields appear under it.
  4. Fill in both fields. If each campaign has its own pixel, leave them empty.
  5. Click Save («Сохранить»).

Instead of a saved token, the field shows ***. An empty field and *** keep the previous token. To remove the token, click Delete («Удалить») next to the field, then Save. Before saving, the Keep («Не удалять») button cancels the deletion.

In a campaign, on the S2S postbacks («S2S-постбеки») tab, the Source postbacks («Постбеки источника») block shows “Facebook CAPI: on” («Facebook CAPI: включён») or “Facebook CAPI: off” («Facebook CAPI: выключен»).

Where the Pixel ID and Access Token come from

The tracker looks for each value in order and takes the first one that is filled in.

OrderPixel IDAccess Token
1The Pixel ID field in the source cardThe Access Token field in the source card
2The click's sub_id_11The click's sub_id_12
3The click's pixel parameterThe click's token parameter
4The pixel row in the campaign parametersThe token row in the campaign parameters

In the campaign parameters, a row matches if its Parameter («Параметр») or Name («Название») is pixel or token.

A Pixel ID contains only digits. A value in curly braces, for example {pixel}, is treated as not filled in.

A separate pixel for each campaign

The source fields apply to all of its campaigns. For different pixels:

  1. Leave the Pixel ID and Access Token fields in the source empty.
  2. In the campaign, open the Source and parameters («Источник и параметры») tab.
  3. In the pixel and token rows, enter the Pixel ID and Access Token in the Value («Значение») column. If the rows are missing, add them with the + Parameter («+ Параметр») button.
  4. Click Save parameters («Сохранить параметры»).

In the “Facebook Ads” source template, the pixel parameter is bound to sub_id_11 and token to sub_id_12. They come into the campaign with the values {pixel} and {token} — replace them. The token parameter does not go into the traffic link; the tracker substitutes it on its own — see Campaign link, domain and parameters.

Which conversions are sent to Facebook

Conversion status in the trackerEvent in Facebook
leadLead
salePurchase

The final status is used — see How the status is determined. If the network sent ftd and a conversion type mapped it to a sale, Purchase is sent. For other statuses, including rejected and hold, there is no event.

  • A postback without the status parameter is treated as a lead: it sends Lead.
  • A status change for the same transaction, for example from lead to sale, sends a new event.
  • An exact repeat of a postback with the same txid and a correction of the payout alone do not create a new event. A lead after a sale for the same transaction is skipped.
  • Without txid, each postback creates an event again, except for a lead after a sale without txid for the same click: it is skipped — see Postback without txid.
  • With conversion import, events are sent only if the Send outgoing S2S and CAPI («Отправлять исходящие S2S и CAPI») checkbox is checked.

For Purchase, the tracker sends the payout amount in USD — see Currencies and rates. Lead has no amount. The event name and currency cannot be configured.

What data is sent

DataSource
IP, User-Agent, country, region, cityFrom the click
Facebook click IDThe click's fbclid parameter or the click's sub_id_10
fbpThe fbp parameter of the postback or the click
EmailThe postback email parameter or sub_id_7
PhoneThe postback phone parameter or sub_id_8
First and last nameThe postback first_name and last_name parameters. If the postback has name or sub_id_9, the first word becomes the first name and the rest becomes the last name
Event page URLThe click's sub_id_13 or the click's event_url parameter. If empty — https://facebook.com/
External IDThe click subid

If the network did not send an email, phone or name, the tracker takes the landing page form data bound to the click — see Receiving leads from forms.

Email, phone, first name, last name, city, region and country are sent to Facebook hashed. IP, User-Agent, click ID, fbp and subid are sent as is.

Event ID and the browser pixel

Each event has an event_id:

text
{subid}:lead
{subid}:sale
{subid}:lead:{txid}
{subid}:sale:{txid}

The last two lines apply when the network passes txid or tid in the postback.

Facebook uses the event name and event_id to merge the tracker's event with the same browser pixel event. If the pixel is on the “thank you” page, pass the same event name and the same eventID in it. For a lead without a transaction ID, this is {subid}:lead.

Check

  1. Send a postback with the lead status for a click from this source, or wait for a real conversion.
  2. Open Logs → Event delivery («Логи → Доставка событий»).
  3. Choose CAPI in the type list.
  4. Click Find («Найти»).

A sent event has the Done («Выполнено») state. Other states are on the Event delivery log page.

Tip.

A test postback sends a real Lead event to Facebook.

If the event was not sent

There is no CAPI row in the delivery log

Check that:

  • the click's source has the Facebook Conversions API checkbox checked;
  • the campaign had this source selected at the time of the click;
  • the final status is lead or sale;
  • this is not an exact repeat, a payout correction or a lead after a sale.

CAPI: pixel/token not found (not in the source, the click or the campaign parameters) («CAPI: pixel/token не найдены (ни в источнике, ни в клике, ни в параметрах кампании)»)

Logs → S2S postbacks («Логи → S2S postbacks») also contains rows about S2S postback deliveries. Look for a row that starts with “CAPI: pixel/token not found” («CAPI: pixel/token не найдены») and ends with the click subid: the tracker did not find the Pixel ID or Access Token. Fill in the fields in the source or the pixel and token parameters in the campaign. For conversions that have already been received, the event will not be sent: it is created when the postback is received.

State “Needs review” («Нужна проверка»), result capi_error

Facebook did not accept the event or did not respond. After a network error and 5xx and 429 responses, the tracker retries the delivery on its own — see Automatic retries. Other errors, for example an invalid token or pixel, are not retried. A Pixel ID that contains anything other than digits gives the same result.

Fix the Pixel ID or Access Token in the source — the next conversions will be sent with the new values. Editing the campaign parameters does not change the values stored in the click. The Retry («Повторить») button sends the event with the previous pixel and token.

State “Pending” («Ожидает»), result license_hold

The license is not active: conversions are accepted, while events wait for renewal and are sent automatically after it — see License expiry.

Updated Need help? ↗