Connect Google Tag Manager to Donation Forms
When your website uses Google Tag Manager, donation forms will send custom events to Google Tag Manager during the donation process. Google Tag Manager can be used along with Google Analytics so that you are not only tracking donor behaviors, but also organizing the data or you can use it without Google Analytics.
Set up Google Tag Manager
To create an account and container, follow Google’s instructions. Don't install a web container.
Set up Google Analytics with Google Tag Manager
If you want to use Google Analytics with Google Tag Manager, you should also follow Google's instructions to set up it up in Google Tag Manager. Then, you can create tags for donation forms events.
Note: For embedded donation forms, create a Configuration Parameter in Configuration settings for Google Tag Manager to send Google Analytics the events. For the parameter add cookie_flags. Add samesite=none;secure for the value.
1. Event parameters and variables
To create variables, follow Google’s instructions for user-defined variables and user-defined variable types for web.
You should create the following parameters with variables:
-
event_categoryis alwaysdonation_form. -
event_labelis the name of the donation form. -
valueis the donation amount.
2. Events
Create a tag for each event:
-
For Standard Forms the events are
form_submitted,checkout_complete, anddonation_complete. -
For Optimized Forms the events are
checkout_completeanddonation_complete.
3. Tags for standard events
To create a GA4 event tag for Purchase:
-
From Google Tag Manager, create a new tag.
-
For the tag type, select Google Analytics: GA4 Event, and your existing GA4 Configuration Tag.
-
Set the Event Name to purchase.
-
From Ecommerce, select both Enable Enhanced Ecommerce Features and Use data layer.
4. Link trigger to Purchase Event tag
In the GA4 Purchase Event tag, select your custom event trigger.