Automatic form interaction tracking in GA4
Recently Google Analytics 4 got an update for Enhanced Measurement capabilities adding some events related to the form interactions. In this post, we will take a look at automatic form interaction tracking in GA4 – how it works, how to set it up, and known issues.
What is Form interaction tracking in GA4?
When the Enhanced Measurement setting is enabled GA4 will attempt to collect 2 additional events automatically:
- form_start – Sent the first time a visitor interacts with a form in a session.
- form_submit – When a visitor submits the form.
Using these events you can theoretically calculate a share of users who completed the form out of everyone who started filling it.
In addition to the event names, it will attempt to collect some descriptive form information automatically.
Automatically collected parameters
Here is a list of custom parameters that could be captured (as described by Google):
- form_id – ID attribute of <form> DOM element
- form_name – Name attribute of <form> DOM element
- form_destination – Action attribute of <form> DOM element (where form data is sent)
- form_submit_text – Text of the submit button if any. (only form_submit event)
NB! These parameters are not available for reporting by default. You need to create custom dimensions if you want to create custom reports based on these values.
In reality, there are a few more parameters that GA4 tries to collect about the form automatically (and they are not documented at the moment).
For the form_submit you might see an additional parameter:
- form_length – it will contain the total number of all inputs in a given form (including hidden ones). Not really useful if you are trying to analyze form length impact on form completion rate from a UX point of view.
form_start will contain the form length and the following ones below:
- first_field_id – ID attribute of first <input> DOM element
- first_field_name – Name attribute of first <input> DOM element
- first_field_position – In my tests, it was always reporting a value of “1”. If you have observed other behavior let me know in the comments!
- first_field_type – Type attribute of first <input> DOM element
It seems that the attributes mentioned above (form_start) are not passed if a form was submitted in the background using javascript (e.g. from Facebook – more on that below).
How to enable Form tracking in GA4?
To enable automatic form tracking in GA4 you need to open Web data stream settings and open the Enhanced measurement configuration section.
From there enable the “Form interactions” option.
You might want to reconsider and keep this disabled yet since it has some known flaws at the moment of writing.
How well does it work?
There is currently no detailed documentation on when exactly form_start or form_submit should fire. I would say it is expected that this won’t work on all of the forms and especially the ones using non-standard elements and inputs. But how well does it work with standard <form> and <input> elements?
Here are a couple of my observations on when each of the events is fired:
form_start event:
- Triggered when you switch between form fields (click or tab)
- Triggered when something was typed and focus is lost on the form field or browser window for ~5 seconds (e.g. you click somewhere else on the screen)
- Triggered together with form_submit if the form_start event hasn’t fired yet.
- Not triggered if you just focus on the field
- Not tracking if you start typing inside form fields
form_submit event:
- Triggered when the completed form is submitted
- Can be triggered multiple times per session for the same form
- Triggered unexpectedly when using some 3rd party tags (Facebook, Snapchat, other pixels)
- Not triggered if you try to submit an empty form (with required=”true” attribute)
- Not triggered for embedded 3rd party iframe forms
The issue with 3rd party tags
If you are using Facebook, Snapchat, and other pixels most likely you will see events being sent in the background (on the page load). Facebook and other vendors might submit some forms in the background using javascript, which is also counted by GA4 automatically.
When using these (and potentially other) vendor tags you will see inflated form_submit and form_start event counts.
Some of the form_submit events are also sent multiple times when submitting one form, since other vendors may collect additional data when the form is sent as well.
If you decide to enable this feature and have no ability to track the form interactions manually – always test when these events are triggered. The form submission count will most likely not match the real number by a large margin.
How to test form interaction events in GA4?
To better understand how this feature works with your tag setup, always test it with different forms and different scenarios. To see when and what data is passed we can use GA4 DebugView or use a 3rd party plugin like Google Analytics Debugger.
I will use GA4 Debug View and enable it using Preview mode in GTM.
With the preview mode enabled interact with the forms that you have on the website to see if events are sent as expected. Check this article if you want to learn more about working with Preview mode in GTM.
If you are not using GTM you can investigate those events using any of the 3rd party plugins out there (one example mentioned above).
Open Debug View in GA4 from the right side menu.
When you have submitted or interacted with form fields you should see form_submit and form_started events appear in the event timeline if those were triggered.
You can click on each of the events to inspect what attributes are received by GA4.
If you don’t see a particular event attribute it means it had an empty value and GA4 was not able to retrieve it. For e.g. I have no form_name or form_id attributes since my form didn’t have any of those values attached to the <form> DOM element.
Answer these questions when testing form events
- When I submit a form is form_submit event sent?
Identify any forms that are not tracked automatically as you may need to implement tracking manually using GTM or with a help of a developer. - Is form_submit event triggered multiple times when a form was sent only once?
The event should be sent only once per form submission. Multiple events would indicate a conflict with 3rd party tags (e.g. Facebook/Meta pixel) - Do my form_submit events are sent without completing a form (e.g. on a pageview)?
In this case, it would indicate an issue with 3rd party pixels. - If form_submit is sent in unexpected scenarios – what is a form_destination attribute value?
It will allow you to use those as a filter in your reports to have cleaner reports.
Where to find form interaction events in GA4?
To analyze collected data about the form in a readable report you will need to do 2 things:
1. Create custom dimensions for any event attributes that you want to include in the reports.
For example, if you would like to differentiate between different forms on the website you would need to create a custom dimension using form_destination attribute. Since ID or name could be missing for most of the forms.
So in GA4 you would go to Configure > Custom definitions and add the following custom dimension:
Check this guide on Custom dimensions in GA4 if you want to learn more about how it works.
2. Create a custom report in GA4
To display collected form interaction data go to the Explorations section (from the main left menu) and create a new Exploration.
From the dimension list import the “Event name” field + any additional fields that you have created as custom dimensions (from collected attributes). I will use just the Form destination in this example.
Also Total users from the metric list.
In the filters section add an Event name condition to match only events that start with “form_”.
Alternatively, you could filter only form_submit and form_start in a separate tab of the report.
Now double-click on all dimensions and metrics to add them to the tab settings and display a report.
Now you should be able to see a similar report that I have here to see which forms were started and sent by form destination location.
Order this by form destination (click on the column title) to have a more clear view of how many times each form was started and completed.
Notice that some Eevens have (not set) values in the Form destination field. These are the cases when Form destination dimension was not yet created when the event occurred. Make sure to create those as soon as you have enabled the event tracking (or before that).
If you have issues with form events from 3rd party pixels (e.g. Facebook) you will see some useless data here. Let’s take a look at how to filter those as well.
How to clean up form interaction report?
If during the testing you have discovered issues from 3rd parties you may need to exclude those from your reports:
Review your report or check event values in preview mode to identify domains that shouldn’t be reported.
For example, if you see a lot of form_submit events from facebook.com – just add it as a filter like this:
Do the same for any other form destinations that shouldn’t appear in the report (or just include only your own domain in the Form Destination field).
Summary
As you can see automatic form interaction in GA4 doesn’t work as well as expected, but you might still be able to extract some useful data from it. The most important issue at the moment is that GA4 captures Facebook, Snapchat, and other vendor background form submissions, which will inflate your event count. You might be able to filter most of those events by applying an additional filter to your reports.
If you are using Google Tag Manager you might want to consider implementing this properly with a custom setup.
To find more about automatically collected events you can check my overview of Enhanced Measurement in GA4.