Conversions API

Before diving into the implementation steps and code examples, it is important to note that for integrating the Conversion API must first share their Facebook Pixel with us so we can associate it with the corresponding brand.

What Is the Conversion API?

Facebook’s Conversion API allows you to send web events directly from your server to Facebook. This ensures better data accuracy and improved event tracking, especially in scenarios where browser-side tracking (like the Facebook Pixel) might be blocked or limited. To make proper use of this API in our platform, we require some essential information during campaign creation.

Note: The Conversion API is currently supported only for Link Clicks campaigns. We plan to expand support to additional campaign types in the future.

When creating a campaign that uses the Conversion API, the following fields must be considered:

  1. conversion_enabled (boolean):
    This is an optional field that indicates whether the conversion tracking is enabled for the campaign.
  2. conversion_event_name (string):
    This is an optional field, but required if conversion_enabled is set to true. It specifies the name of the event that will be used for the conversion.
  3. conversion_domain (string):
    This is an optional field, but required if conversion_enabled is set to true. It indicates the domain of the website from which the event will be triggered and sent to Facebook.

Example

Below, you will find an example of how a campaign payload would look with the explained fields included.

{
  "provider": "facebook",
  "campaign_type": "link_clicks",
  "campaign_name": "campaign Link clicks from API",
  "metadata": {
    "budget": {
      "value": 12,
      "currency": "USD"
    },
    "start_date": "2024-08-20T05:00:00.000Z",
    "end_date": "2024-08-21T05:00:00.000Z",
    "call_to_action": "LEARN_MORE",
    "instagram_post_id": "17921761666746619",
    "link_to_boost": "https://www.goodreads.com/book/show/5907.The_Hobbit?ref=rae_2",
    "caption": "test caption",
    "targeting_countries": [
      {
        "name": "Recommended Markets",
        "budget": 1,
        "locations": [
          {
            "value": "US",
            "label": "United States of America",
            "type": "country",
            "region_id": null,
            "country_code": null
          }
        ]
      }
    ],
    "targeting_audiences": [
      {
        "fbId": "6003317001363",
        "name": "Zendaya"
      }
    ],
    "targeting_demographic": {
      "age": {
        "min": 18,
        "max": 35
      },
      "gender": "All",
      "languages": [
        {
          "key": 6,
          "name": "English (US)",
          "selected": true
        },
        {
          "key": 24,
          "name": "English (UK)",
          "selected": true
        }
      ]
    },
    "conversion_enabled": true,
    "conversion_event_name": "Subscribe",
    "conversion_domain": "symphony.to"
  }
}