If your website exists to generate enquiries, you need to track form submissions in GA4. Without that data, you cannot tell which pages produce leads, which campaigns deserve more budget or whether your contact form is working at all.
Google Tag Manager (GTM) makes this possible without editing your theme files. This guide walks through the process step by step, covers the three most common ways to detect a submission and shows you how to test the result before you rely on it.
What You Need Before You Start
- A GA4 property and its Measurement ID, which starts with G-.
- Google Tag Manager installed on your website. If it is not, follow our guide on how to set up Google Tag Manager on a WordPress website.
- Your GA4 base tag working inside GTM. See how to set up Google Analytics with Google Tag Manager if you have not done this yet.
- Edit access to both GA4 and GTM.
Choose the Right Method for Your Form
Not every form behaves the same way, and that is the main reason form tracking fails. Pick the method that matches how your form works.
| Method | Best for | How it detects a submission |
|---|---|---|
| Form Submission trigger | Standard HTML forms that reload or redirect the page | GTM listens for the browser’s form submit |
| Custom event from the form plugin | AJAX forms that send without reloading, such as Contact Form 7 | The plugin fires a JavaScript event that you pass to GTM |
| Thank-you page view | Forms that redirect to a confirmation page | A page view trigger on the thank-you URL |
If your form redirects to a unique thank-you page, Method 3 is usually the simplest and most reliable. For forms that stay on the same page, use Method 1 or 2.
Method 1: Track Form Submissions in GA4 With the Form Submission Trigger
Step 1: Enable the built-in form variables
In GTM, open Variables, click Configure under Built-In Variables and tick the options in the Forms section: Form Element, Form Classes, Form ID, Form Target, Form Text and Form URL. These are populated whenever the trigger fires, and you will use them to identify the correct form.
Step 2: Create the trigger
- Go to Triggers and click New.
- Choose Form Submission as the trigger type.
- Tick Wait for Tags. According to Google, this holds the form submission until dependent tags finish firing or a timeout passes, which prevents the next page from loading before the tag has been sent.
- Tick Check Validation. Google explains that with this option the trigger fires only after the form is successfully submitted, instead of on every attempt, including ones that fail validation.
- Under This trigger fires on, choose Some Forms and add a condition such as Form ID equals contact-form, so that other forms (a search box or newsletter field, for example) are not counted.
- Name it Form Submission – Contact Form and save.
Step 3: Create the GA4 event tag
- Go to Tags and click New.
- Choose Google Analytics: GA4 Event.
- Enter your Measurement ID.
- Enter an Event Name using lowercase letters and underscores. We recommend
generate_lead, one of Google’s recommended event names, or a clear custom name such ascontact_form_submit. - Add an event parameter named
form_idwith the value {{Form ID}}. - Attach the trigger you created in Step 2 and save.
One warning about naming: if the Form interactions option of enhanced measurement is enabled in your GA4 data stream, GA4 may already collect form_start and form_submit events automatically. To avoid confusing or duplicate data, do not reuse those names for your own tag.
Method 2: Track AJAX Forms Such as Contact Form 7
Many WordPress forms submit in the background without reloading the page. The standard Form Submission trigger often misses these. The Contact Form 7 documentation describes several DOM events that fire after an AJAX submission, including wpcf7mailsent when the mail was sent successfully, and the event details include the form’s ID through contactFormId. We can pass that event to GTM through the data layer.
Step 1: Add a Custom HTML tag
Create a new tag of type Custom HTML, paste the following code and set its trigger to All Pages:
<script>
document.addEventListener('wpcf7mailsent', function (event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'cf7_mail_sent',
form_id: String(event.detail.contactFormId)
});
}, false);
</script> Notice that the code sends only the form ID. Never push names, email addresses or message text into the data layer for analytics purposes, because Google Analytics terms do not allow sending personally identifiable information.
Step 2: Create a Data Layer Variable
Go to Variables and create a new Data Layer Variable. Set the Data Layer Variable Name to form_id and save it as DLV – form_id.
Step 3: Create a Custom Event trigger
Create a trigger of type Custom Event with the event name cf7_mail_sent. If you have several forms, you can add a condition such as DLV – form_id equals 123.
Step 4: Create the GA4 event tag
Follow the same steps as Method 1, Step 3, but add {{DLV – form_id}} as the value of the form_id parameter and attach the Custom Event trigger. Other form plugins offer their own events or hooks, so check the plugin’s documentation for the equivalent.
Method 3: Track a Thank-You Page
If the form redirects to a confirmation page, create a Page View trigger that fires on Some Page Views where Page Path equals /thank-you/ (use your own URL). Attach it to the same GA4 Event tag. This method is simple and robust, although it can overcount if visitors reload the page or return to it later. If possible, make the thank-you page inaccessible without a submission.
Test Everything Before You Publish
- Click Preview in GTM and enter your website address. Tag Assistant will open your site.
- Submit the form. In the Tag Assistant summary, confirm that the trigger event appears and that your GA4 Event tag is listed under Tags Fired.
- Submit an invalid form on purpose. If you enabled Check Validation, the tag should not fire.
- In GA4, open Admin, then DebugView, and confirm the event arrives with the
form_idparameter. - Return to GTM, click Submit, add a version name such as “Track contact form submissions” and publish.
Mark the Event as a Key Event in GA4
Tracking an event is not the same as treating it as a conversion. In GA4, open Admin, go to Events under Data display, find your event and click the star icon to mark it as a key event. Google notes that standard reports can take up to 24 hours to show the key event, while realtime reports update within minutes, and that marking an event only affects data from that point forward.
To use form_id in reports, also create an event-scoped custom dimension for it under Admin and Custom definitions. Google states that event parameters can be used in reports only after you register custom dimensions for them.
Troubleshooting Common Problems
| Problem | Likely cause | Fix |
|---|---|---|
| Trigger never fires | Form submits through AJAX or JavaScript | Use Method 2 or a plugin-specific event |
| Fires on failed submissions | Check Validation is off | Enable Check Validation or use a success event |
| Counts twice | Enhanced measurement and your tag both collect the event, or two triggers overlap | Use a unique event name and review your triggers |
| Event missing in reports | Standard reports are delayed | Check DebugView and Realtime first, then wait up to 24 hours |
| Form ID is empty | The form has no ID attribute | Use Form Classes, Form URL or a data layer value instead |
| Nothing arrives at all | Ad blocker, consent settings or wrong Measurement ID | Test in a clean browser and check your consent configuration |
Need Help Setting It Up?
Form tracking looks simple until a theme, a caching plugin or a custom form gets in the way. As a freelance web developer and digital marketer with hands-on experience in WordPress, GA4 and Google Tag Manager, I can audit your current tracking, implement reliable form and conversion events, and connect the data to your reports. If you would like help, you can contact me on LinkedIn.
Frequently Asked Questions
Do I need Google Tag Manager to track forms in GA4?
No, but it is the most flexible option. You can also send events with code in your theme or through a plugin, though GTM keeps tracking changes outside your website files and gives you a built-in preview mode.
Which event name should I use for a contact form?
Use generate_lead if you want to follow Google’s recommended naming, or choose a descriptive custom name such as contact_form_submit. Avoid reusing form_submit if enhanced measurement is collecting it.
Why does my form track in Preview but not on the live site?
The usual causes are an unpublished GTM container version, a caching plugin serving an old page, an ad blocker or a consent banner that blocks analytics until the visitor accepts.
Can I track which page the form was submitted from?
Yes. GA4 automatically records the page location with every event, so you can see which pages generate the most submissions in your reports.
Final Thoughts
To track form submissions in GA4 reliably, match the method to your form, send only non-personal data, test in Preview and DebugView and mark the event as a key event. Once the data flows, you can build funnels, compare traffic sources and finally measure what your website really delivers.
