This article introduces how to do form tracking in Google Analytics 4, and will introduce multiple methods and their advantages and disadvantages.
To be able to use Form Submission to track the form, the code of the page needs to meet two conditions:
- The code of the form structure is in <form> </ form>, and there is a unique class or id on it
- The type of the confirm button is submit, that is, there must be code such as type = submit.
- ‘form_start’: the first time a user interacts with a form in a session
- ‘form_submit’: when the user submits a form
This turns on form tracking, which is very convenient.
However, this method sometimes does not track accurately. If your website is installed with Facebook Pixel and has done Facebook event tracking, it will 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 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.
You only need to know the class or id in the form to set the trigger:
The final trigger complete configuration looks like this:
Then can set the tags:
Further reading: Use GTM Form Submission Trigger for Form Tracking
Element Visibility is a GTM built-in trigger for tracking the display of an element.
For example, this method can be used to track when a window or information is displayed after the form is successfully submitted.
Page View refers to the opening of a page, and a specific page opening can be set as a trigger condition.
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.
Third Party Form
If you are using 3rd party forms like Klaviyo Forms, Gravity Forms…
You can look at their documentation, and generally provide form tracking methods that can be implemented with GTM.
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.