Skip to content
Analytics October 12, 2026 8 min read

How to Track Form Submissions using Google Tag Manager (GTM)

How to Track Form Submissions using Google Tag Manager (GTM)

To track form submissions using Google Tag Manager (GTM), you create a trigger that detects the submission, attach a GA4 event tag to it, and verify the whole chain in Preview mode before publishing. The catch is that the built-in Form Submission trigger only works on plain HTML forms that reload the page, and most contact forms built in 2026 submit over AJAX without a page reload. That is why a single setup method almost never covers every form on a site.

Below are the four approaches that cover virtually every form you will run into, from a basic WordPress contact form to a HubSpot embed, plus how to push the event into GA4 and Google Ads.

Why the Built-In Form Submission Trigger Often Fails

GTM’s native trigger listens for the browser’s submit event on a <form> element, documented in the MDN reference for the submit event. Plenty of modern form plugins intercept that event with JavaScript, cancel the default behaviour, and send the data in the background.

When that happens, GTM may still see the submit event, but the page never navigates, so the tag gets killed mid-flight or fires on validation errors. You end up with either zero conversions or wildly inflated ones. The usual suspects:

  • AJAX forms (Gravity Forms with AJAX enabled, WPForms, Elementor Forms, Contact Form 7)
  • Embedded third-party forms in an iframe (HubSpot, Typeform, Calendly) where GTM cannot see inside the frame
  • Multi-step forms that fire a submit event on each step
  • Forms with client-side validation that submit even when required fields are empty

Check which type you are dealing with before building anything. Submit the form yourself and watch whether the URL changes.

Set Up Your Container Before Building Triggers

Two housekeeping steps save a lot of guesswork later. First, turn on the form-related built-in variables in GTM under Variables, Configure: Form ID, Form Classes, Form Element, Form Target, Form URL and Form Text.

Second, confirm your GA4 configuration tag already fires on all pages. If the base tag is missing or duplicated, every event you build on top of it will report strange numbers, the same way duplicated property setups distort engagement metrics.

Method 1: The Native Form Submission Trigger

Use this when your form causes a real page load after submission. It takes about five minutes.

  1. In GTM, go to Triggers, click New, and choose Form Submission.
  2. Tick Wait for Tags (2000 milliseconds is a sensible default) and Check Validation so the tag only fires on genuine submissions.
  3. Set “Enable this trigger when” to the page the form sits on, for example Page Path contains /contact.
  4. Set the fire condition to Form ID equals your form’s ID, which you can read in Preview mode or in the page source.
  5. Save, then build a GA4 Event tag named generate_lead and attach the trigger.

Google’s own notes on the Form Submission trigger explain the validation option in more detail. If Check Validation causes the tag to never fire, your form is almost certainly AJAX-based, so move to method 3 or 4.

Method 2: Tracking the Thank-You Page or Confirmation URL

The most reliable method, when it is available, is a redirect to a dedicated confirmation page. A Page View trigger on a URL that can only be reached after a successful submission is almost impossible to break.

  1. Create a trigger of type Page View.
  2. Fire on Some Page Views where Page Path contains /thank-you or whatever your confirmation slug is.
  3. Attach a GA4 Event tag with an event name such as generate_lead or contact_form_submit.

Add noindex to that thank-you page so it does not surface in search results, and keep an eye on it inside Search Console. The Search Console setup walkthrough covers how to check whether pages like that are being indexed by accident, which inflates conversion counts when people land on them directly.

Method 3: Element Visibility for Inline Confirmation Messages

Many AJAX forms swap the form out for a green success message. That message is a DOM element you can watch.

  1. Submit the form on your own site, right-click the success message and choose Inspect.
  2. Copy its CSS selector or ID, something like .wpforms-confirmation-container.
  3. Create a trigger of type Element Visibility, selection method CSS Selector, and paste the selector.
  4. Set Minimum Percent Visible to 50 and fire Once per page.
  5. Tick “Observe DOM changes” so GTM watches for elements injected after page load.

The one risk is a confirmation container that exists in the DOM but stays hidden until needed. Test by loading the page without submitting anything; if the tag fires, tighten the selector or raise the visibility threshold.

Method 4: dataLayer Pushes, the Method That Never Breaks

If you can get five minutes of developer time, a dataLayer push beats every other option. The form’s own success callback tells GTM that the submission succeeded, so no guessing from DOM behaviour.

The snippet a developer adds to the success handler looks like this:

window.dataLayer = window.dataLayer || []; dataLayer.push({'event': 'form_success', 'form_name': 'contact_main'});

In GTM you then create a Custom Event trigger with the event name form_success, and a Data Layer Variable named form_name to pass through as an event parameter. Several plugins already do this for you: Gravity Forms, HubSpot and Elementor Pro all push events you can listen for without writing code.

The payoff is that you can send extra context with each lead (form name, plan selected, lead type) rather than a bare count of submissions.

Sending the Event to GA4 and Google Ads

A trigger alone records nothing. Pair it with a GA4 Event tag that references your Measurement ID, give the event a clean lowercase name with underscores, and add parameters that will matter in reporting later.

  • form_name so you can separate contact, quote and newsletter forms
  • page_location to see which landing pages actually produce leads
  • value if you assign an average lead value, which makes ROAS reporting possible

In GA4, open Admin, Events, and mark the new event as a key event. It takes up to 24 hours before it appears in standard reports, though DebugView shows it within seconds. From there you can import it into Google Ads as a conversion action, which is the same pipeline described in the guide to tracking offline conversions and phone calls from Google Ads.

Accurate form tracking also exposes the gap between traffic and revenue. If a campaign pulls clicks but your generate_lead count stays flat, the diagnostic steps in the piece on clicks with zero conversions are the right next read.

Debugging Checklist Before You Publish

Run every one of these in GTM Preview mode with GA4 DebugView open in a second tab:

  • Submit the form correctly and confirm the tag fires exactly once.
  • Submit with a required field blank and confirm the tag does not fire.
  • Test on mobile, where some themes render a second form in a hidden drawer.
  • Check the GA4 real-time report for the event name and its parameters.
  • Reload the thank-you page directly and see whether a duplicate fires.

Only publish the container version once all five pass. Name the version clearly (“Contact form lead tracking, element visibility”) because future you will want to know what changed and when.

Frequently Asked Questions

Why Is My GTM Form Submission Trigger Not Firing?

In most cases the form submits over AJAX, so the browser’s native submit event is cancelled and GTM never sees a completed submission. Switch to an Element Visibility trigger on the confirmation message, or ask a developer to add a dataLayer push in the form’s success callback.

Do I Need a Thank-You Page to Track Form Submissions?

No, a thank-you page is optional, though it remains the most stable method of the four. Element visibility triggers and dataLayer pushes both track inline confirmations without any redirect, which suits single-page checkouts and embedded forms.

How Long Until Form Submissions Show Up in GA4?

Events appear in DebugView within about 10 to 30 seconds and in the Realtime report within a few minutes, but standard reports typically take 24 hours. Key event status also needs up to 24 hours before conversion columns populate.

Can I Track Forms Inside an Iframe Like HubSpot or Calendly?

Not with standard triggers, because GTM cannot read across domains inside an iframe for security reasons. HubSpot and Calendly both broadcast JavaScript messages you can capture with a Custom HTML listener tag that pushes an event to the dataLayer.

Should the Event Be Named generate_lead or Something Custom?

Use generate_lead when the submission represents a sales enquiry, since it is a recommended GA4 event that unlocks extra reporting. Custom names such as newsletter_signup make more sense for lower-intent forms you do not want counted as leads.

Get Your Form Tracking Audited

If your lead numbers in GA4 have never quite matched the enquiries landing in your inbox, the fix is usually one broken trigger. SEO Quirk can review your container, rebuild the triggers that misfire, and connect the clean data to Google Ads, or browse more analytics walkthroughs on the SEO Quirk blog.

Leave a Reply

Your email address will not be published. Required fields are marked *