There are several methods to track your marketing campaigns and website fundraising performance. Sending conversion data directly to Google Analytics is one of the most common methods. This article provides a few suggestions for sending Funraise donation conversion data to Google Analytics 4.
In this example, we're using Google's gtag.js to create a gtag purchase conversion event for a successful donation by adding a gtag event script into a Funraise Giving Form onSuccess event handler.
βοΈ Custom code required
Sending conversion data to Google Analytics requires basic knowledge of javascript and gtags. Please note, our team is not able to support custom code configurations.
Looking for a code-free marketing analytics tracking solution? You might want to start with tracking UTM data in Funraise, which enables you to report on revenue from specific marketing campaigns or sources.
How it works
Assuming you've already properly installed your gtag.js and your Funraise Giving Form on your page, you'll just need to add a Funraise onSuccess event handler that contains code to create a Google purchase conversion event. Adding the Google purchase event tag to an onSuccess event handler will cause the code to execute each time a successful transaction occurs.
We recommend creating a purchase event to track conversions because it's a Google-recommended method that has a few extra relevant properties. It's good to know that you can use this method to also create your own custom tracking events based on your strategy.
Passing donation properties
Simply knowing that a conversion happened is helpful, but you'll also want to pass important data with each conversion, for example, the amount of the donation or the form name. With Funraise's event handlers, you can pass donation properties to Google Analytics as parameters with the purchase event.
The properties you pass will depend on your strategy, but we recommend at least including the following donation properties:
Funraise donation property | Google event parameters |
donation.transactionId | transaction_id |
donation.amount | value |
donation.currency.name | currency |
donation.formName | item_name |
donation.frequency | item_category |
Example Google Analytics 4 conversion event configuration
Below we've added a Google Tag purchase conversion event into a Funraise onSuccess event handler.
Assuming you've properly installed your gtag.js and Funraise Giving Form code, the below onSuccess configuration is all that's needed to additionally send a conversion event to Google Analytics 4. To use this configuration for your form, just update the Form id. We recommend placing this script at the bottom of your page <body>.
<script>
window.funraise.push('onSuccess', { form: XXXX }, function(donor, donation) {
gtag("event", "purchase", {
transaction_id: donation.transactionId,
value: donation.amount,
currency: donation.currency.name,
items: [
{
item_name: donation.formName,
item_category: donation.frequency
}
]
});
});
</script>