Donorbox allows us to run scripts after the donation is successfully made. We can make use of this feature to track the donations on the Facebook Pixel account.
1. Click on the edit symbol under the campaign to which the tracking script is being added:
2. Select the 'Tracking & Analytics' subsection under the Donation Form section:
3. Add the below tracking script to the Post donation tracking field as indicated in the screenshot that follows. Make sure to replace 'XXXXXXXXX' with your Facebook Pixel ID.
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'XXXXXXXXX');
fbq('track', 'Purchase', {
value: DONORBOX.donation.amount,
currency: DONORBOX.donation.currency
});
</script>Click the 'Save Changes' button to save your changes.
Note: The above example script tracks the donations as a "Purchase" event on your Facebook Pixel account. Feel free to include any additional data you may want to track alongside the event.
For more details on what additional data can be included, please refer to https://developers.facebook.com/docs/meta-pixel/implementation/conversion-tracking/#object-properites
For details about what information is available for tracking, please refer to https://donorbox.zendesk.com/hc/en-us/articles/4403843443348-What-is-the-information-available-for-tracking-in-the-After-donation-tracking-code-field