Reliable form tracking in Google Tag Manager means firing on the form's success signal, not on the submit button or the browser's submit event. For most modern sites that signal is a JavaScript event or callback from the form tool, which you turn into a single dataLayer push. Where no such event exists, use a thank-you page redirect or the success message appearing on screen. GTM's built-in Form Submission trigger only works well on classic forms that do a real browser submit, which is a shrinking share of client sites.
This guide is for agency PPC and tracking teams who inherit a client's site and need form leads counted correctly in GA4 and Google Ads. It covers why the built-in trigger fails, the right signal for each common form tool, the GTM setup, and how to prove it works before you tell the client their conversions are fixed. If a client has already noticed the gap, our fix page on GA4 form submissions not being tracked is a faster diagnostic.
Why the Form Submission trigger often doesn't fire
GTM's Form Submission trigger listens for the browser's standard form submit event on a <form> element. It has two options that matter:
- Wait for Tags: holds the submission briefly so tags can fire before the next page loads.
- Check Validation: fires only if the form is actually sent. With it off, the trigger fires on every submit attempt, including ones that fail validation.
That design assumes a form that submits the old way: the browser posts the data and loads a new page. Most forms on client sites today don't behave like that.
- AJAX forms stop the browser's default submit and send the data in the background with JavaScript. With Check Validation on, GTM sees a submission that was never "sent" and stays silent. With it off, the trigger fires on every click of submit, including empty or invalid forms.
- Forms without a real form element. Some page builders and custom builds use a
<div> and a button with a click handler. There is no submit event to hear.
- Embedded forms in iframes (Typeform, Jotform, many CRM forms) run on another domain. GTM on the parent page cannot see anything inside the frame.
- Multi-step forms can fire submit-like events on each step, so a working trigger can still count one lead three times.
GA4's enhanced measurement has a Form interactions option that sends form_start and form_submit. It has the same blind spots, because it also relies on the form element and its submit. It is fine as a rough signal of engagement. Don't use form_submit as a key event, and if you build your own lead event, give it a different name so the two are never confused in reports.
The fix is not a cleverer trigger. It is a better signal.
Pick the success signal for each form type
Inventory every form on the site and the tool that renders it. Then pick the best signal for each, in this order: a documented success event, a thank-you page redirect, then the success message becoming visible.
| Form type | Best signal | Fallback |
| Contact Form 7 | wpcf7mailsent DOM event | Success message visibility |
| Gravity Forms (AJAX on) | gform_confirmation_loaded jQuery event | Confirmation set to redirect to a page |
| WPForms (AJAX on) | wpformsAjaxSubmitSuccess event | Confirmation set to redirect to a page |
| Elementor Pro forms | Front-end submit_success event (test it) | Redirect action after submit |
| HubSpot embedded forms | HubSpot's global form events | Redirect to a page on the client's domain |
| Typeform | Embed SDK onSubmit callback | Redirect on completion |
| Jotform and other iframe forms | Redirect to a thank-you page on the client's domain | None reliable from the parent page |
| Classic HTML form that loads a new page | Thank-you page, or Form Submission trigger with Check Validation | None needed |
Option 1: thank-you page redirect
If the form sends people to a URL that only loads after a successful submission, fire on that page view. In GTM that is a Page View trigger with a condition such as Page Path equals /thank-you-contact. It is simple and survives most front-end changes.
Watch for three problems:
- Shared thank-you pages. If five forms land on the same
/thank-you, you lose which form produced the lead. Use one page per form, or add a parameter such as ?form=quote and read it with a URL variable.
- Reloads and bookmarks. Every reload is another conversion. Set the Google Ads conversion action to count one per click for leads, and pass a transaction ID where you have one.
- Direct access. Keep thank-you pages out of search results and out of the site navigation so the only route to them is a real submission.
Option 2: success message and the Element Visibility trigger
Many AJAX forms replace the form with a success message such as "Thanks, we'll be in touch." GTM's Element Visibility trigger can fire when that element appears. The options to set:
- Selection method: ID if the message has a stable ID, otherwise a CSS selector scoped tightly to the success message, not to the whole form.
- When to fire: once per page for a single form; once per element if there are several forms and each should count.
- Observe DOM changes: turn this on. The success message usually doesn't exist when the page loads, and without this setting GTM won't notice it being added.
- Minimum percent visible: the default is 50 percent. If the message appears in a popup or near the bottom of the screen, check that it actually reaches that threshold, or lower it.
This is the most fragile option. A theme update that renames a class breaks it silently, and a selector that also matches the error message counts failed submissions. Use it when the form tool offers nothing better, and document the selector.
Option 3: a dataLayer push from the form's success event
This is the approach we default to. The form tool already knows when a submission succeeded. You listen for that moment and push one event into the data layer, with the parameters you want in reports. Every platform tag then fires from that single push.
The listener can live in the site's code, which a developer adds, or in a GTM Custom HTML tag that fires on all pages (or on the pages with forms). The pattern looks the same for every tool:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'lead_form_success',
form_tool: 'cf7',
form_id: '123',
form_name: 'contact_main'
});
Use the same event name across all clients so your container template works on every account. Our GA4 key events and naming plan covers how to keep those names and parameters consistent.
Contact Form 7
Contact Form 7 documents a set of DOM events for AJAX submissions. The two that matter:
wpcf7mailsent: the submission completed and the mail was sent. Use this one for conversions.
wpcf7submit: the submission completed regardless of outcome, which includes invalid input, spam and failed mail. Don't use it for conversions.
The events bubble up to the document, so one listener covers every form on the page. The form ID is in event.detail.contactFormId.
<script>
document.addEventListener('wpcf7mailsent', function (event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'lead_form_success',
form_tool: 'cf7',
form_id: String(event.detail.contactFormId)
});
});
</script>
If the site's mail setup breaks, wpcf7mailsent stops firing and so does the conversion. Worth knowing when conversions drop to zero overnight.
Gravity Forms
Gravity Forms documents gform_confirmation_loaded, a jQuery event fired on AJAX-enabled forms when the confirmation message is displayed. It passes the form ID as the second argument.
<script>
jQuery(document).on('gform_confirmation_loaded', function (event, formId) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'lead_form_success',
form_tool: 'gravity_forms',
form_id: String(formId)
});
});
</script>
Two conditions: AJAX must be enabled on the form embed, and the confirmation must be a message rather than a redirect. If the client's form redirects to a page, track that page instead. The listener also needs jQuery loaded before it runs, so check sites that defer jQuery.
WPForms
WPForms' developer documentation uses a wpformsAjaxSubmitSuccess event bound to the form element, and states that it only fires when AJAX submission is enabled in the form's settings. Bind a jQuery listener for it to the form (the form element's ID looks like wpforms-form-780) and push the same dataLayer event as above. If AJAX is off, the page reloads after submission and you are back to a thank-you page or confirmation message.
Elementor Pro forms
Elementor Pro's form widget triggers a submit_success jQuery event on the form after a successful submission, and it is widely used for tracking. It is not part of Elementor's published developer documentation, though, so treat it as something to verify on each site: listen for it in the browser console, submit a test, and confirm it fires once and only on success. The documented alternative is the form's own "Redirect" action after submit, which gives you a thank-you page to track.
HubSpot embedded forms
HubSpot has two generations of forms, and the events differ. Forms built in HubSpot's current forms editor fire events on window. The one you want is hs-form-event:on-submission:success, with the form ID in event.detail.formId. Legacy forms post a browser message with type hsFormCallback, and the event to use is onFormSubmitted, which fires after the submission has been saved.
<script>
window.addEventListener('hs-form-event:on-submission:success', function (event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'lead_form_success',
form_tool: 'hubspot',
form_id: event.detail.formId
});
});
</script>
A listener written for legacy forms silently stops working when the client rebuilds the form in the new editor, so re-test whenever a HubSpot client "updates the form".
Typeform
Typeform's embed SDK has an onSubmit callback that receives the formId and responseId, and Typeform states it only fires for successful submissions. With the HTML embed, you add data-tf-on-submit with the name of a global function; with the JavaScript SDK, you pass onSubmit in the options. Push to the data layer from that function. A plain iframe pasted in without the SDK gives you no callback at all, so either switch the embed to the SDK or set a redirect on completion to a page on the client's domain.
Jotform and other iframe forms
For Jotform and most other hosted form tools, the dependable route is a redirect after submission to a thank-you page on the client's own domain. Jotform's thank-you settings allow redirecting to an external link. When the form is embedded, that redirect takes over the whole page rather than loading inside the frame, which is what you want for tracking. Don't build a client's main conversion on browser messages whose format the vendor doesn't document.
Whatever listener you write for a message event from an iframe, check event.origin against the form tool's domain so another script on the page can't fake a lead.
Wire it up in GTM
Once the push exists, the GTM side is the same for every form tool:
- Listener tag (if not in the site code): a Custom HTML tag containing the relevant listener, firing on Initialization or All Pages, limited to pages that have forms if you can.
- Trigger: a Custom Event trigger matching
lead_form_success.
- Variables: Data Layer Variables for
form_tool, form_id and form_name.
- Exceptions: if a newsletter form fires the same event, either push a different event from it or add a trigger condition that excludes its form ID. A newsletter signup is not a lead.
Send it to GA4 as a key event
Create a GA4 Event tag that fires on the Custom Event trigger and sends generate_lead, a GA4 recommended event for lead forms. Add form_id and form_name as event parameters, and register them as event-scoped custom dimensions in GA4 if you want to report on them.
Then mark generate_lead as a key event in GA4 (Admin, Data display, Events, then the key event toggle). If the client values leads differently by form, send value and currency as parameters. GA4 still counts the event if those are missing, but it won't pass a value on to Google Ads without them.
Send it to Google Ads as a conversion
You have two routes, and you should pick one per conversion action, not both as primary:
- Google Ads conversion tag in GTM. In Google Ads, open the conversion action and choose to set it up with Tag Manager to get the Conversion ID and Conversion Label. In GTM, add a Google Ads Conversion Tracking tag with those values, fired by the same Custom Event trigger. Make sure the container has a Conversion Linker tag firing on all pages. This is our default for lead-gen bidding because it does not depend on GA4 attribution or processing.
- Import the GA4 key event. Simpler to maintain, but the numbers will follow GA4's attribution and consent behaviour, and you will see more delay.
If you run both, set one as primary and the other as secondary so Smart Bidding doesn't count every lead twice. While you're in the tag, this is the moment to add enhanced conversions, since the form success event is exactly where the email address is available; see our enhanced conversions setup guide. Phone leads need a separate setup, covered in our guide to Google Ads call conversion tracking.
Test in Tag Assistant before you publish
Click Preview in the GTM workspace, connect to the client's site in Tag Assistant, and run these tests for every form in the inventory:
- Submit with a required field empty. Your custom event must not appear in the Tag Assistant event list, and no conversion tags should fire.
- Submit a valid test entry. The custom event appears once. Click it and confirm the GA4 and Google Ads tags show as fired, and the variables hold the right form ID and name.
- Double-click submit. Still one event.
- Multi-step forms: step through every page. Only the final success produces the event.
- Check GA4. Look for
generate_lead in DebugView or the Realtime report with the expected parameters.
- Confirm with the client that the test lead arrived, then have it deleted.
After publishing, check the Google Ads conversion action's status over the next day or two. If it stays at no recent conversions while real leads are coming in, work through our checklist for Google Ads conversions not recording.
Where agencies trip up
- Firing on the submit button click. It counts failed validations, spam and double clicks. It is the most common cause of inflated form conversions we see in audits.
- Using
wpcf7submit instead of wpcf7mailsent. The first fires for invalid and spam submissions too.
- Leaving the old trigger running. After adding the new event, the old Form Submission or click trigger often stays attached to the tag. Now each lead counts twice.
- Forgetting the form tool can change. A rebuilt form or a turned-off AJAX setting breaks tracking without any error. Add a monthly check or alerting.
- Counting newsletters and job applications as leads. Separate them by form ID before they reach Google Ads bidding.
- Pushing personal data into GA4. Email addresses and phone numbers belong in enhanced conversions (hashed), not in GA4 event parameters.
Getting it done for a client account
The work in form tracking is the inventory, the testing, and noticing when a site change breaks it. Our call and form tracking service covers that for agency clients. If you'd rather have this set up and tested for a client, send us one account.