Our confirmation page signals a user’s successful return from the checkout with a “checkoutSuccess” event.

You can piggyback off this event to trigger conversion tracking by adding a snippet like this to your form’s Advanced tab:

<script>
  document.addEventListener("checkoutSuccess", function (event) {

    *<!-- GTM CONVERSION TRACKING CODE GOES HERE -->*

  }, { capture: true, once: true });
</script>

When “checkoutSuccess” fires, it provides details about the donation and the donor through event.detail properties. You can use these to send rich data to a GTM custom event, e.g.:

<script>
  document.addEventListener("checkoutSuccess", function (event) {
    const eventDetail = event.detail || {};
    const amount = eventDetail.amount;
    const currency = eventDetail.currency;
    const embedded = window.embedded || false;

    // Only send tracking data if we have valid amount and currency
    if (amount && currency) {
      const trackingData = {
        event: 'YOUR_CONVERSION_TRACKING_EVENT ',
        value: parseFloat(amount),
        currency: currency.toUpperCase()
      }
      // Send donation event to parent window when form is embedded
      if (embedded) {
        window.parent.postMessage(trackingData , '*');
      } else {
        // Send donation event to data layer when not embedded
        window.dataLayer = window.dataLayer || [];
        window.dataLayer.push(trackingData );
      }
    }

  }, { capture: true, once: true });
</script>

Need more help? Not to worry! Just email our support team at [email protected] 🙂