How to Track Form Submissions in Google Tag Manager
Form submission tracking is one of the most commonly botched implementations in GTM. Here's how to do it correctly for both native and AJAX forms.
AttriModel Team
AttriModel Team
Native HTML Forms vs AJAX Forms
The method you use depends on how your forms are built:
Native HTML forms submit via HTTP request and reload the page. GTM's built-in Form Submit trigger works here.
AJAX forms submit without a page reload (common in React, Vue, and Webflow). GTM's form trigger often misses these. You need dataLayer.push() from the form library or a custom listener.
Method 1: GTM Form Submit Trigger (Native Forms)
- In GTM, go to Triggers → New
- Trigger type: Form Submission
- Check "Wait for Tags" and "Check Validation"
- Filter: Form ID equals "contact-form" (or your form's ID)
Create a GA4 Event tag with this trigger:
- Event name: form_submit
- Parameters: form_id = {{Form ID}}, form_name = "Contact Form"
Method 2: dataLayer Push (AJAX Forms)
Ask your developer to add this code on successful form submission:
`javascript
// Fires after successful form submission
window.dataLayer.push({
'event': 'form_submit',
'form_name': 'Contact Form',
'form_location': 'hero_section'
});
`
Then in GTM, use a Custom Event trigger matching the event name "form_submit".
Method 3: Thank-You Page Tracking
The simplest approach: redirect to a /thank-you page on submission. Add a standard Page View trigger that fires only on /thank-you. No form trigger needed.
Downside: users who close before redirect or who stay on-page after submit are missed.
What to Include in Your Form Event
Capture as much context as possible:
- form_name: Human-readable form identifier
- form_location: Where on the page (hero, popup, footer)
- form_type: contact, demo-request, newsletter, checkout
Verifying It Works
- Enable GTM Preview mode
- Submit the form (use test data)
- Check the GTM debug panel for your Custom Event or Form Submit
- Verify the GA4 Event tag fired
- Check GA4 DebugView to confirm the event arrived
Marking as Conversion in GA4
In GA4 Admin → Events, find your form_submit event and toggle "Mark as conversion." Now it appears in acquisition reports as a conversion metric.