You can integrate SureCart purchases with Facebook Pixel. To do this, you will want to add a bit of custom code to your site. The easiest way to do this is to use a free code snippets plugin, though you can do this in your theme or with a separate plugin too.
Our checkout component emits an event called scOrderPaid
, which happens when a checkout is paid. This lets you listen for the event, and look at the checkout data to send to facebook pixel. An easy way to do this is to add this to your site’s footer. Here’s an example:
add_action(
'wp_footer',
function() { ?>
<script>
window.addEventListener('scOrderPaid', function(e) {
const checkout = e.detail;
if( checkout && checkout.amount_due ) {
fbq('track', 'Purchase', {
currency: checkout.currency,
value: checkout.amount_due / 100,
email: checkout.email,
name: checkout.name
});
}
});
</script>
<?php
}
);