Donorbox allows us to run scripts after the donation is successfully made. We can make use of this feature to track the donations on Facebook Pixel account.
1. Click on the edit symbol under the campaign to which the tracking script is being added:
2. Select the edit icon under Technical:
3. Add the below tracking script to the After donation tracking codes 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,
content_category: 'donation',
content_name: DONORBOX.donation.form.name,
content_ids: [DONORBOX.donation.form.id],
content_type: DONORBOX.donation.donation_type });
</script>
Note: The above example script tracks the donations as "Purchase" on your Facebook Pixel account.
Comments
0 comments
Please sign in to leave a comment.