Update time: January 13, 2025
This article introduces how to do form tracking in Google Analytics 4.
Enhanced Measurement
GA4’s Enhanced Measurement has built-in Form interactions, which can track the form, there are two events:
- form_start: the first time a user interacts with a form in a session
- form_submit: when the user submits a form
Click Enhanced Measurement in Web stream details, and then check 「Form interactions:」
Read More : GA4 Event Tracking Series ② —— Enhanced Measurement Events
- Advantages: Just check the box to turn it on, the setting is very convenient.
- Disadvantages: If your website is installed with Facebook Pixel and has done Facebook event tracking, it may cause Form interactions to be triggered, because Facebook Event sends data in the form of a form. Therefore, if your website has Facebook Pixel installed, it is not suitable to use Form interactions for form tracking.
Form Submission Trigger
Form Submission is a built-in trigger in GTM, specially used for fire a tag when a form has been sent, can be used to track successful form submissions.
Read More : How to Track forms with Form Submission Trigger in GTM
- Advantages: Built-in trigger for easy setup.
- Disadvantages: The form code has 2 requirements.
- HTML must include a <form> tag, ensuring that both the browser and the trigger can recognize it as a form.
- There should be at least one <input> or <button> element with its type attribute set to submit for users to submit the form.
Element Visibility Trigger
Element Visibility is a GTM built-in trigger for fires when a selected element becomes visible in the web browser’s viewport.
If the form submission is successful, it will be displayed or poped up something, then, we can use Element Visibility to track this form submissions.
Read More:「GTM」Using Element Visibility for Form Submission Tracking
- Advantages: Built-in trigger for easy setup.
- Disadvantages: Only for use in certain circumstances
Page View
If a special page is opened after the form is successfully submitted, such as a thank you page, you can use Page View to track it.
- Advantages: Easy to set up
- Disadvantages: Refreshing will cause duplicate triggering.
Third Party Form
If you are using 3rd party forms like Klaviyo Forms, Gravity Forms,Contact Form 7…
You can look at their documentation, and generally provide addEventListener methods or jQuery methods that can be implemented with GTM, please see the specific implementation:
- Form Tracking for Klaviyo Forms on Google Tag Manager
- Form Tracking for Gravity Forms on Google Tag Manager
- Form Tracking for Contact Form 7 on Google Tag Manager
Please see the specific principles:
- GA4 Event Tracking Series ⑦ —— Custom Events (addEventListener Method)
- GA4 Event Tracking Series ⑧ —— Custom Events (jQuery Method)
- Advantages: 3rd party forms support
- Disadvantages: Old version browsers do not support addEventListener/jQuery and will not be able to track
dataLayer.push
If none of the previous methods work, you can use the dataLayer.push method.
Whenever the form is submitted successfully, send the event with dataLayer.push, eg:
<span style="font-size: 12pt;">dataLayer.push({ 'event': 'submit_form', 'form_id': 'demo_request', 'form_message': 'error' }); </span>
Please see the implementation principle: : GA4 Event Tracking Series ⑩ —— Custom Events (dataLayer.push Method)
- Advantages: Tracking is accurate
- Disadvantages: Need support from DE or development resources
Custom Events
If none of the previous methods apply, you can consider custom event tracking only for click forms.
Although the data is not accurate, it can still be used as a reference.
Read More:
- GA4 Event Tracking Series ④ —— Custom Events (gtag Method)
- GA4 Event Tracking Series ⑤ —— Custom Events (Attributes Method)
- GA4 Event Tracking Series ⑦ —— Custom Events (addEventListener Method)
- GA4 Event Tracking Series ⑧ —— Custom Events (jQuery Method)
- GA4 Event Tracking Series ⑨ —— Custom Events (ga-data Method)
- GA4 Event Tracking Series ⑩ —— Custom Events (dataLayer.push Method)