Skip to content

Web and product analytics

How to track form submissions with Google Tag Manager

By the editors of Analytics1.comLast reviewed 19 October 20263 min read

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
  1. Pick the method that matches your form
  2. Method 1: the Form Submission trigger
  3. Method 2: the thank-you page
  4. Method 3: a data layer push (most reliable)
  5. After the event arrives
  6. Questions
  7. Sources

Pick the method that matches your form

MethodWorks whenWatch out for
Form Submission triggerThe form fires a real browser submit eventBackground (AJAX) forms that never submit; errors counted as leads unless Check Validation is on
Thank-you page viewSuccess sends the visitor to a separate URLPeople reloading or bookmarking the page; the URL being reachable without submitting
Data layer eventYour developer or form plugin can push an event on successNeeds a small code change or a plugin that already does it
Element visibilityA success message appears on the same pageFragile if the message's selector changes in a redesign

Method 1: the Form Submission trigger

  1. 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.
  2. 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).
  3. 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.
  4. Create a GA4 Event tag named generate_lead, with your measurement ID, and parameters such as form_name. Attach the trigger.
  5. 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