You can use the Meta Conversion API to receive events about purchases.
Tip
This is about data protection.
If necessary:
Customize the privacy policy page.
Activate the cookie consent.
How to add Meta Conversions API to your thank you page:
Prepare Conversions API
- Log into your Meta account.
-
Configure the Conversions API in Meta:
-
Select the type Manual.
-
Copy the access key and the pixel ID.
-
The data is in the clipboard. You can insert the data in the next step.
Integrate meta pixels
-
Integrate the pixel in your thank you page.
-
In Digistore24, set up an IPN with the type Meta Conversions API.
Use the copied access key and pixel ID.
Set up thank you page
If you're using the default thank you page from Digistore24, you don't need to do anything else. The default thank you page is programmed to automatically work alongside the Meta Conversions API IPN.
If you have created your own thank you page:
-
Copy the code.
<!-- Insert code under the Meta 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: order_id });
})();
</script> -
Integrate the code as a tracking code.
Insert the code below the code for the meta pixel.
-
In the header bar, click on Save.