Web and product analytics
How to track form submissions with Google Tag Manager
The short answer
Use GTM's built-in Form Submission trigger with Check Validation ticked if your form does a normal page submit. If it submits in the background (most modern form plugins do), fire on the thank-you page or, best of all, have the form push a dataLayer event on success and trigger a GA4 generate_lead event from it. Always confirm in Preview that the trigger fires on success and not on a failed attempt.
On this page 7 sections
Pick the method that matches your form
| Method | Works when | Watch out for |
|---|---|---|
| Form Submission trigger | The form fires a real browser submit event | Background (AJAX) forms that never submit; errors counted as leads unless Check Validation is on |
| Thank-you page view | Success sends the visitor to a separate URL | People reloading or bookmarking the page; the URL being reachable without submitting |
| Data layer event | Your developer or form plugin can push an event on success | Needs a small code change or a plugin that already does it |
| Element visibility | A success message appears on the same page | Fragile if the message's selector changes in a redesign |
Method 1: the Form Submission trigger
- In GTM, open Variables, then Configure, and tick the built-in Form variables: Form Element, Form Classes, Form ID, Form Target, Form URL and Form Text.
- Create a trigger of type Form Submission. Tick Wait for Tags (so the GA4 hit is sent before the page unloads) and Check Validation (so it fires only when the form is successfully sent, not on every attempt).
- Set "This trigger fires on" to Some Forms and add a condition, for example Form ID equals quote-form. Google recommends limiting the trigger this way.
- Create a GA4 Event tag named generate_lead, with your measurement ID, and parameters such as form_name. Attach the trigger.
- Preview, submit the form with valid and then invalid data, and check the tag fires only on the valid submission.
If nothing fires at all in Preview when you submit, your form is almost certainly submitting in the background. Use one of the other methods.
Method 2: the thank-you page
If a successful submission lands on /thank-you, create a Page View trigger where Page Path equals /thank-you and fire the generate_lead tag on it. Make sure the page carries noindex and is not linked anywhere, or visitors who find it by other routes become leads.
Method 3: a data layer push (most reliable)
Ask your developer, or check your form plugin's settings, for a success callback that runs: window.dataLayer.push({ event: 'form_success', form_name: 'quote' }). In GTM create a Custom Event trigger for form_success, a Data Layer Variable for form_name, and fire the GA4 generate_lead tag from it. Many form tools (HubSpot, Gravity Forms, Typeform embeds and others) already emit a JavaScript event or message you can listen for; check their documentation before writing code.
After the event arrives
- Mark generate_lead as a key event in GA4 (Admin, then Events) and register form_name as a custom dimension if you will report on it.
- Never send the visitor's name, email or phone number in the event or the page URL. Google's terms prohibit personal data in GA4.
- GA4 knows a form was sent. It does not know whether the enquiry was a good one or became a sale. To judge lead quality, record each lead with its source in a lead tracking tool or your CRM: see how to track form submissions and leads.
Questions
- Why does the GTM Form Submission trigger not fire?
- Usually because the form sends its data in the background with JavaScript and never fires a browser submit event, or because another script stops the event. Track the thank-you page, the success message, or a dataLayer event pushed on success instead.
- What does Check Validation do in a GTM form trigger?
- With Check Validation ticked, the Form Submission trigger fires only when the form is successfully sent. Without it, the trigger fires on any submit attempt, including ones the form rejects, which overcounts leads.
- What should a form submission be called in GA4?
- Use Google's recommended event name generate_lead for an enquiry, quote or contact form. Recommended names feed standard reports and map cleanly to Google Ads conversions.
Sources
Next step
Try the conversion rate calculator
Related guides
How to set up Google Tag Manager (and GA4 through it)
Google Tag Manager set-up step by step: account and container, the two snippets, the Google tag for GA4, preview with Tag Assistant, and publishing versions.
How to set up event tracking in GA4
GA4 event tracking step by step: automatic, enhanced measurement, recommended and custom events, key events, custom dimensions, and how to test them.
How to track form submissions and leads back to their source
How to record the source, campaign and keyword of every form lead, in GA4 and in your CRM, and when a lead tracking platform is worth it.
How to track phone calls from Google Ads
Three ways to track calls from Google Ads (call assets, website call conversions and a call tracking platform), what each one misses, and how to set them up.