How to measure conversions and e-commerce with the Google Analytics add-on from Gravity Forms
Gravity Forms is a very popular plugin for managing forms in WordPress. You can set up simple contact forms to sales or donation forms with Gravity Forms. Before Pronamic Pay, Gravity Forms was the first plugin we integrated with in 2011. With the introduction of Google Analytics 4, Gravity Forms has updated the Google Analytics add-on to version 2.0. With this plugin it is possible to measure conversions from Gravity Forms to Google Analytics 4. However, measuring e-commerce purchases is not possible 'out-of-the-box'. In this article we explain how you can set this up so that you can also track 'purchase' events.
Gravity Forms & Google Analytics
Since June 1, 2023, Gravity Forms has its own Google Analytics 2.0 add-on launched. With this add-on it is possible to send form activities to Google Analytics. Think of form submissions, but any pagination of forms can also be tracked as an 'event' in Google Analytics.
The Google Analytics add-on offers four possibilities to connect Analytics to Gravity Forms, namely:
- Google Measurement Protocol – This option is recommended by Gravity Forms. It is the easiest way to link and you can use it to make events from Gravity Forms measurable in Analytics. This option does not send utm parameters and does not contain any data required for Google Ads or Remarketing.
- Google Analytics – This option is more extensive and offers the possibility to fully integrate Google Analytics within the site. It also supports Google Ads and Remarketing.
- google tags manager – If your website already uses this, choose this option to have your forms hook up to the Tags, Triggers and Variables of GTM.
- ManualConfiguration – This option offers the possibility to manually establish a link with Google Analytics. This is for advanced users.
Except for the manual pairing, pairing with the other three options is done by logging into your Google account and giving permission for the Gravity Forms pairing. After which you can link the desired Analytics property or Tag manager container.
Measure conversions with Gravity Forms
Once the Google Analytics add-on has been installed and linked, you can create a feed in the form settings. Within this feed you can assign values to event parameters. In Analytics you can use these events and parameters in your reports.
For example, in line with the old UA analytics, you can create event parameters for 'category', 'action', label and 'value', as in the example below.

Once form events are measured, you can mark them as conversions in Google Analytics so that you can use them in your analytics and marketing activities.
Google Tag Manager for e-commerce measurements
For example if you donations with Gravity Forms receive, or you have an order form for a product. Then you may also want to have this measurable in Google Analytics. You can solve this with events and an event value, or you can use e-commerce tracking.
Not possible to track e-commerce events with the direct link of Gravity Forms and Google Analytics. If you want to be able to keep track of this, you have to use the google tags manager clutch.
Once Google Tag Manager has been linked to your form settings, you can then link the fields or custom values per form to dataLayer variables in Google Tag Manager.
To start measuring a purchase you need a tag with purchase
Provision GA4 event. This event should provide you with the correct ecommerce values that you get from the dataLayer variables. Google tells in the page “Set up a purchase event” what values these should be. The minimum values you need are:
- transaction_id = a unique transaction number
- value = total value of the purchase
- currency = the currency of the purchase
- items = the items that are part of the purchase
- item_id = a unique product number
- item_name = the name of the product
- price = the price of the product
- quantity = the number of pieces of the product
- * If you sell multiple products, multiple items can be added to this value.
You can load these values into Google Tag Manager by creating various user-defined variables. You can use the values below.
Data Layer variables
Name | Type | Value |
---|---|---|
Ecommerce Items | Custom JavaScript Variable | |
Ecommerce currency | Data Layer Variable | ecommerce.currency |
Ecommerce transaction_id | Data Layer Variable | ecommerce.transaction_id |
Ecommerce value | Data Layer Variable | ecommerce.value |
Ecommerce items.item_id | Data Layer Variable | ecommerce.items.item_id |
Ecommerce items.item_name | Data Layer Variable | ecommerce.items.item_name |
Ecommerce items.price | Data Layer Variable | ecommerce.items.price |
Ecommerce items.quantity | Data Layer Variable | ecommerce.items.quantity |
Optional variables | ||
Ecommerce items.item_category | Data Layer Variable | ecommerce.items.item_category |
Ecommerce items.item_variant | Data Layer Variable | ecommerce.items.item_variant |
E-commerce items as Javascript variable
You can place the code below in a Custom Javascript Variable. This will correctly add the items to the purchase
event.
function() {
return [
{
item_id: "Related Data Layer Variable",
item_name: "Related Data Layer Variable",
price: Related Data Layer Variable,
quantity: Related Data Layer Variable,
//optional variables
item_category: "Related Data Layer Variable ",
item_variant: "Related Data Layer Variable"
}
// Add any additional items here
];
}
In the manual below, we explain step-by-step how to use the above variables and a purchase
measure event purchases from your Gravity Forms form to Google Analytics.
Set up measuring e-commerce purchases with Gravity Forms and Google Analytics
What do you need for the installation?
- Gravity Forms + Google Analytics add-on
- Google Tag Manager (GTM)
- google analytics 4
Follow the step-by-step guide below to measure e-commerce purchases from Gravity Forms in Google Analytics using Google Tag Manager.
We assume that you already have a Google Analytics account and Google Tag Manager container and that Gravity Forms is active on your website.
- Install and connect the Google Analytics add-on
First, you need the Google Analytics add-on install and link with your Google account. Choose the Google Tag Manager option to link with.
- Create variables in GTM
Under 'Variables' add all the above variables and replace text “Related Data Layer Variable” with the actual variables.
- Add a trigger to GTM
Under 'Triggers' add a 'Custom event' trigger that will be called by Gravity Forms later. For example, name it 'GFTrackEvent' and activate it for 'All custom events'.
- Create a GA4 'purchase' event in GTM
Add a new GA4 event.
– At 'Configuration tag', select the tag to which you link the Google Analytics property.
– Enter the value at 'Event name'purchase
on.
– Under 'Event parameters', enter the four minimum values you need. - Google Analytics feed for your Gravity Forms form
Now create a feed in the form settings for which your submissions are
purchase
want to measure in Analytics.
– In this feed, choose the trigger you just created in the 'Tag Manager Trigger' field.
– Under Parameters, make sure you fill all parameters with the related values from your form. - Test your link with the GTM preview mode
All necessary steps have been completed. You can now test your form. By placing the form on a test page and entering the url of this page in the 'preview' option of Google Tag Manager.
You can submit the form in the preview window. In the preview mode of Google Tag Manager you can see exactly whether the created Variables are filled and the Tag is activated by the specified trigger. - Check the event in Google Analytics
In Google Analytics you can select an option 'DebugView' under the Property settings. In this view you can see whether the created
purchase
event is created. Do you see this again? Then you have set all the components correctly. - Publish the Google Tag Manager container
Finally, you can now publish the GTM container. This ensures that all components you have added will be live and used for your website. From now on you can configure these settings for every 'e-commerce' form on your website.
Comments
No support for deferred actions
With the Pronamic Pay plugin it is possible to have an order paid directly via a payment provider. The Pronamic Pay plugin supports Gravity Forms's ability to defer actions until successful payment. Unfortunately, at the moment (August 2023) it is not (yet) possible to postpone the Google Analytics feed until a successful payment has been made. Because the Google Analytics add-on does not (yet) support this option.
Format of product amount in Euros
The notation of amounts in Euros is different from, for example, the US Dollar. The thousands and decimal separators are exactly opposite of each other. Google uses the standard notation according to the Dollar for Analytics, with a comma as a thousand separator and a point as a decimal separator.
The Gravity Forms Google Analytics add-on does use the correct format for the total amounts of a form. For product prices they use the standard Euro notation. As a result, the product value in Google Analytics is now not measured properly.
Gravity Forms has indicated that this is being worked on and will be fixed in a future update.
If you use a dropdown or variant as a product field, you can use the :price
modifier to get the correct notation.