Facebook Conversions API integration

  • The Facebook Conversions API integration allows you to pass conversion details from CPV Lab Pro to Facebook Ads and have them appearing in your Ads Manager account.

  • This is very important for the optimization and the delivery of your Facebook ads.

  • Since the beginning of 2021, Facebook data reporting for iOS devices was greatly limited, with less data that can be tracked by Facebook. This means that conversion reporting became more important and the Conversions API integration helps tracking iOS devices.

Pre-requirements

  • CPV Lab Pro Version 8.1
  • At least one active campaign on Facebook Ads
  • The campaign should be configured to use the no-redirect tracking method (with the Direct Traffic code placed in the landing page) which offers the best performances for Facebook Ads.
  • More details about Facebook Ads campaigns you can find here

Setup the Facebook Conversions API integration

1. Create a Facebook Pixel (if not already created)

CAPI - Facebook Pixel creation

  • Enter a name for your pixel and get the generated pixel code.
  • Place the pixel code in your landing page by following the Facebook instructions!
  • For best tracking performances, go to the pixel Settings tab and disable (set to OFF) these 2 options:
    • Automatic Advanced Matching - OFF
    • Track Events Automatically Without Code - OFF
  • Make sure that you keep the option "First-Party Cookies" set to On.

CAPI - Facebook Pixel settings

2. Get the Pixel ID

  • In the Setting tab for your pixel, look for the numeric Pixel ID and save it in a safe place. It will be needed later for the integration

CAPI - Facebook Pixel ID

3. Generate the API Access Token

  • The API Access Token is needed in order to access the API from CPV Lab Pro.
    • Go to the Settings tab for your pixel and click on the "Generate access token" link.
    • You will get a multiline textbox with the Access Token (letters and digits).
    • Copy this in a safe place as it will be needed later for the integration.

CAPI - API Token

4. Verify your domain on Facebook

  • Facebook requires you to verify the domain that you send conversions from.
    • This is your landing page domain because you have access to it in order to perform the verification.

Steps:

CAPI - Verify Domain

  • Then select to add a new domain (the landing page domain) and perform the domain verification using one of the provided methods.
    • The easiest option would be to create a TXT record in the DNS settings of the domain at the domain registrar.

CAPI - Verify Domain 2

Changes in the campaign setup from CPV Lab Pro

Edit your Facebook Ads campaign from CPV Lab Pro and perform the following changes (if not already made).

    1. Make sure that the Traffic Source from your campaign in CPV Lab Pro is named “Facebook” or “Facebook Ads”

CAPI - Campaign Setup Traffic Source

    1. Set fbclid as the External ID Token parameter, as shown below:

CAPI - Campaign Setup Traffic Source

    1. Look for the new Facebook specific section in the "Tracking Pixel" area of the campaign setup page. Here is where you need to add the Facebook API details:
    • API Access Token – the access token generated above
    • Pixel ID – the ID of your Facebook Pixel created above
    • Event Name – the name of the event you want to pass to Facebook for each conversion. The default name is Purchase
    • Amount – the revenue that you want to pass to Facebook.
      • The default value of the {!revenue!} placeholder which will be replaced by the actual revenue.
      • You can also set a fixed numeric value
    • Currency – the currency for your revenue (3-letter ISO code). The default option is USD.

CAPI - Campaign Setup Tracking Pixel

    1. Choose to capture User Agents and IP Addresses from your visitors in the campaign setup page
    • You can also capture other Data Options from the list if you need them in your reports.

CAPI - Campaign Setup Visitors

    1. Change the landing page to include new code for Facebook tracking
    • You should already have 2 blocks of code in your landing page:
      • the 2 lines of code from Step 2 in the campaign setup page
      • and the JavaScript version of the Direct Traffic node.
    • Now you also need to add a new line of code for Facebook Tracking, after the existing code:
<script type="text/javascript">fbCapiTrack()</script>

The CPV Lab Pro code from your landing page should look like this: CAPI - CPV Lab Pro Code

Save your landing page and upload it on the server.

Check that conversions get reported

Once the above are implemented, CPV Lab Pro will automatically send conversion details to Facebook each time the Postback URL gets fired from the Affiliate Network in your campaign.

After receiving a few new conversions in your campaign, you should make sure that these were posted to Facebook by looking in 2 places:

  • In the Conversions Log page from CPV Lab Pro – you will see a record starting with "type":"fbapi and with the details posted to Facebook for each Facebook API call, something like this:

CAPI - Conversion Log

  • In Facebook, check your pixel and you should see the Purchase event appearing.
    • Choose "View Details", then "Recent Activities".
    • You will get a list with all the latest API requests made from your CPV Lab Pro instance.

CAPI - test Pixel

CAPI - test Pixel

Final Notes

  • Your Facebook Ads campaign setup in CPV Lab Pro is similar to any other campaign, with only these changes:
    • The Facebook API configuration (API Access Token and Pixel ID)
    • A new line of code in the Landing Page for Facebook tracking
  • Also make sure that you have checked to capture User Agents and IP Addresses from your visitors.

TIP

It is very important to place the Facebook Pixel in your landing page. The Facebook pixel will perform part of the tracking and it will be completed with the API call that sends conversion details back to Facebook.

  • There may be a small delay (up to 15 minutes) between the moment conversions are passed from CPV Lab Pro to the Facebook API and the moment that they appear in the Recent Activities report from Facebook. This is normal and doesn’t affect tracking.
Last Updated: 6/14/2021, 11:18:56 PM