Prerequisite: Your site already loads the Meta Pixel base code (the snippet that defines fbq()), or you manage it via Google Tag Manager (GTM).
Add this script to the <head> of your site
Place it immediately after the Double embed code. It listens for theDouble.donationCompletedevent and (a) pushes the data to GTM, and (b) fires a Donate event to Meta.
<script>
document.addEventListener("Double.donationCompleted", e => {
const d = e.detail.donation;
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "donationCompleted",
value: d.amount,
currency: d.currency,
transaction_id: d.id
});
fbq('track', 'Donate', {
value: d.amount,
currency: d.currency,
donation_id: d.id,
event_id: d.id
});
});
</script>Configure Google Tag Manager
Create three Data-Layer variables
valuecurrencytransaction_id
Create a Trigger
Type: Custom Event
Event name:
donationCompleted
Create a Tag
Tag type: “Meta Pixel” template (or Custom HTML if you prefer)
Event name:
DonateParameters:
{
value: {{value}},
currency: {{currency}},
donation_id: {{transaction_id}},
event_id: {{transaction_id}}
}Triggering the
donationCompletedtrigger you just created.
Publish the container.
After the first real-world donation you’ll see the Donate event appear in Meta Events Manager.
Need to track donations without Google Tag Manager?
If you prefer a code-only install, simply remove the dataLayer block above and keep the fbq('track', 'Donate', …) call. That one snippet will do everything.
