The Facebook Conversion API is a server-side conversion tracking tool. It allows you as a vendor/affiliate to track your Facebook ad campaigns reliably while remaining independent of browsers and buyer devices. With API tracking, Digistore24 collects statistical information on the following events and forwards them to Facebook:
- New order
- Start of a subscription
- Payments for a subscription
- End of a subscription
Note
To set up the Conversion API, you'll need a Facebook Business Account.
1. Set up Facebook Conversion API
a) In Facebook
- Set up a Meta Tracking Pixel.
- Generate an access key for this pixel. Use the method "via Events Manager".
- Optional for testing events: Go to "Test Events" in the Events Manager and copy the test code for testing.
After completing these three steps, you should have the following:
- Facebook API access key
- Facebook Pixel ID
- Test event code
Now embed the Facebook tracking pixel on your website.
b) In Digistore24
Here you set up two things:
- Facebook tracking pixel on the order form
- Facebook IPN connection
2. Set up Facebook tracking pixel:
As a vendor: Create a Facebook tracking pixel under: Settings > Order form tracking.
Follow the steps described here.
Note:
- Select Facebook as the tracking type.
- Enter the Facebook Pixel ID in the field.
As an affiliate: Create a Facebook tracking pixel under: Account > Order form tracking.
Follow the steps described here starting from step 2.
Set up Facebook IPN connection:
As a vendor: Create a Facebook IPN connection under: Settings > Integrations (IPN).
Follow the steps described here.
Tip:
Select the products and languages for which an event should be sent to Facebook. Then enter the "API access key," "Pixel ID," and "Test event code."
If you're using a Digistore24 thank you page, your setup is now complete. If you're using your own thank you page, continue with the next section.
As an affiliate: Create a Facebook IPN connection under: Account > S2S Postback.
Follow the steps described here.
3. Optional: Set up tracking pixel on your own thank you page
If you're using your own thank you page, you can track orders there as well. Follow these steps:
- Enable the transfer of all order IDs to your thank you page
It's important that all order IDs are transferred to your thank you page to ensure that already registered sales are not counted twice. - Add the Facebook tracking pixel to your thank you page.
You can find it in the Facebook guide. See the link. - Then add the code section mentioned below.
Insert it below the Facebook tracking pixel. See the link.
Here's how to proceed:
Step 1: Transfer all order IDs to your thank you page
- Either enable the transfer of all order data, as described here.
- Or append the thank you page URL with ?order_id=[ORDER_ID], as described here.
Step 2: Add the Facebook tracking pixel & code section
- Add the tracking pixel to your thank you page. You can find it in this Facebook guide under "Manually add Pixel code to website." A step-by-step guide is also provided there.
- Then add the following code section below the tracking pixel:
<!-- Insert this below the Facebook Pixel -->
<script>
(function () {
function getParameterByName(name, url) {
url = url || window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return "";
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var order_id = getParameterByName("order_id");
var queryParamToFacebookMapping = {
product_id: "content_ids",
product_name: "content_name ",
currency: "currency",
amount: "value",
quantity: "num_items"
};
var purchaseData = { content_type: 'product' };
Object.keys(queryParamToFacebookMapping).forEach(function (name) {
var value = getParameterByName(name);
if (value !== null) {
purchaseData[queryParamToFacebookMapping[name]] = value;
}
});
fbq('track', 'Purchase', purchaseData, {eventID: 'purchase.'+order_id}); })();
</script>
4. How to work with events on Facebook
In Facebook, you can now create custom conversions and ideally filter your product by content ID.
5. How to test your event
- In the Events Manager, select the data source you've set up.
- Click on "Test Events".
- Now open the order form for the product you've set up.
If your event is set up correctly, you will receive information about your events (see screenshot).
Note
If the test doesn't work, please verify whether the EventCode in Facebook matches the EventCode of your IPN connection.
6. Transferring parameters with an IPN connection
With the Facebook IPN connection, these Facebook parameters can be transferred. As a vendor, you can use these to view metrics such as ROAS (Return on Ad Spend - expenditures vs. revenue) and thus better control advertising measures. Other DS24 parameters can also be transferred, such as content_type. We transfer this parameter for all events with product IDs. This helps Facebook recognize that these are actual purchases. To transfer these and other parameters, follow these steps:
- Set up your pixel in Facebook Business Manager according to this guide.
- Set up the conversion API on the pixel:
- Open the Event Manager.
- Go to Data Sources.
- Select the pixel and switch to the Settings tab.
- Under Conversion API, go to the Set up manually field.
- Set up the API:
- The Purchase event must be present.
- Page View can also be used to track page views.
- Category E-commerce and Retail.
- In the next step, select all the parameters that should be transferred. Country cannot be transferred.
- In the final step, select "Manually implement API yourself".
- A new section will open: Apply the Conversion API. Generate an access key here, which will be required for Digistore24 Facebook IPN. Once generated, copy the key and then select Finish Implementation.
- Complete the API setup and click Finish in the instructions section.
- Now switch to Digistore24. a) Go to Settings > Integrations (IPN) > Add new connection. b) Under "For Pros," select Facebook.
- Enter the settings (for which products and languages).
- Insert the API key generated in step 4 and also enter the Pixel ID.
- Go to Settings > Order form tracking.
- Open new tracking > Select desired products.
- Choose where to enter the tracking > Select events > Choose Facebook as the tracking type.
- Enter the Pixel ID and click Save.
The parameters will now be transferred to Facebook and can be viewed in the Pixel overview.