...

How to Track Form Submissions in GA4 With Google Tag Manager (Step-by-Step)

Illustration of a web form sending an event to an analytics chart

If your website exists to generate enquiries, you need to track form submissions in GA4. Without that data, you cannot tell which pages produce leads, which campaigns deserve more budget or whether your contact form is working at all.

Google Tag Manager (GTM) makes this possible without editing your theme files. This guide walks through the process step by step, covers the three most common ways to detect a submission and shows you how to test the result before you rely on it.

What You Need Before You Start

Choose the Right Method for Your Form

Not every form behaves the same way, and that is the main reason form tracking fails. Pick the method that matches how your form works.

MethodBest forHow it detects a submission
Form Submission triggerStandard HTML forms that reload or redirect the pageGTM listens for the browser’s form submit
Custom event from the form pluginAJAX forms that send without reloading, such as Contact Form 7The plugin fires a JavaScript event that you pass to GTM
Thank-you page viewForms that redirect to a confirmation pageA page view trigger on the thank-you URL

If your form redirects to a unique thank-you page, Method 3 is usually the simplest and most reliable. For forms that stay on the same page, use Method 1 or 2.

Method 1: Track Form Submissions in GA4 With the Form Submission Trigger

Step 1: Enable the built-in form variables

In GTM, open Variables, click Configure under Built-In Variables and tick the options in the Forms section: Form Element, Form Classes, Form ID, Form Target, Form Text and Form URL. These are populated whenever the trigger fires, and you will use them to identify the correct form.

Step 2: Create the trigger

  1. Go to Triggers and click New.
  2. Choose Form Submission as the trigger type.
  3. Tick Wait for Tags. According to Google, this holds the form submission until dependent tags finish firing or a timeout passes, which prevents the next page from loading before the tag has been sent.
  4. Tick Check Validation. Google explains that with this option the trigger fires only after the form is successfully submitted, instead of on every attempt, including ones that fail validation.
  5. Under This trigger fires on, choose Some Forms and add a condition such as Form ID equals contact-form, so that other forms (a search box or newsletter field, for example) are not counted.
  6. Name it Form Submission – Contact Form and save.

Step 3: Create the GA4 event tag

  1. Go to Tags and click New.
  2. Choose Google Analytics: GA4 Event.
  3. Enter your Measurement ID.
  4. Enter an Event Name using lowercase letters and underscores. We recommend generate_lead, one of Google’s recommended event names, or a clear custom name such as contact_form_submit.
  5. Add an event parameter named form_id with the value {{Form ID}}.
  6. Attach the trigger you created in Step 2 and save.

One warning about naming: if the Form interactions option of enhanced measurement is enabled in your GA4 data stream, GA4 may already collect form_start and form_submit events automatically. To avoid confusing or duplicate data, do not reuse those names for your own tag.

Method 2: Track AJAX Forms Such as Contact Form 7

Many WordPress forms submit in the background without reloading the page. The standard Form Submission trigger often misses these. The Contact Form 7 documentation describes several DOM events that fire after an AJAX submission, including wpcf7mailsent when the mail was sent successfully, and the event details include the form’s ID through contactFormId. We can pass that event to GTM through the data layer.

Step 1: Add a Custom HTML tag

Create a new tag of type Custom HTML, paste the following code and set its trigger to All Pages:

<script>
document.addEventListener('wpcf7mailsent', function (event) {
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    event: 'cf7_mail_sent',
    form_id: String(event.detail.contactFormId)
  });
}, false);
</script>

Notice that the code sends only the form ID. Never push names, email addresses or message text into the data layer for analytics purposes, because Google Analytics terms do not allow sending personally identifiable information.

Step 2: Create a Data Layer Variable

Go to Variables and create a new Data Layer Variable. Set the Data Layer Variable Name to form_id and save it as DLV – form_id.

Step 3: Create a Custom Event trigger

Create a trigger of type Custom Event with the event name cf7_mail_sent. If you have several forms, you can add a condition such as DLV – form_id equals 123.

Step 4: Create the GA4 event tag

Follow the same steps as Method 1, Step 3, but add {{DLV – form_id}} as the value of the form_id parameter and attach the Custom Event trigger. Other form plugins offer their own events or hooks, so check the plugin’s documentation for the equivalent.

Method 3: Track a Thank-You Page

If the form redirects to a confirmation page, create a Page View trigger that fires on Some Page Views where Page Path equals /thank-you/ (use your own URL). Attach it to the same GA4 Event tag. This method is simple and robust, although it can overcount if visitors reload the page or return to it later. If possible, make the thank-you page inaccessible without a submission.

Test Everything Before You Publish

  1. Click Preview in GTM and enter your website address. Tag Assistant will open your site.
  2. Submit the form. In the Tag Assistant summary, confirm that the trigger event appears and that your GA4 Event tag is listed under Tags Fired.
  3. Submit an invalid form on purpose. If you enabled Check Validation, the tag should not fire.
  4. In GA4, open Admin, then DebugView, and confirm the event arrives with the form_id parameter.
  5. Return to GTM, click Submit, add a version name such as “Track contact form submissions” and publish.

Mark the Event as a Key Event in GA4

Tracking an event is not the same as treating it as a conversion. In GA4, open Admin, go to Events under Data display, find your event and click the star icon to mark it as a key event. Google notes that standard reports can take up to 24 hours to show the key event, while realtime reports update within minutes, and that marking an event only affects data from that point forward.

To use form_id in reports, also create an event-scoped custom dimension for it under Admin and Custom definitions. Google states that event parameters can be used in reports only after you register custom dimensions for them.

Troubleshooting Common Problems

ProblemLikely causeFix
Trigger never firesForm submits through AJAX or JavaScriptUse Method 2 or a plugin-specific event
Fires on failed submissionsCheck Validation is offEnable Check Validation or use a success event
Counts twiceEnhanced measurement and your tag both collect the event, or two triggers overlapUse a unique event name and review your triggers
Event missing in reportsStandard reports are delayedCheck DebugView and Realtime first, then wait up to 24 hours
Form ID is emptyThe form has no ID attributeUse Form Classes, Form URL or a data layer value instead
Nothing arrives at allAd blocker, consent settings or wrong Measurement IDTest in a clean browser and check your consent configuration

Need Help Setting It Up?

Form tracking looks simple until a theme, a caching plugin or a custom form gets in the way. As a freelance web developer and digital marketer with hands-on experience in WordPress, GA4 and Google Tag Manager, I can audit your current tracking, implement reliable form and conversion events, and connect the data to your reports. If you would like help, you can contact me on LinkedIn.

Frequently Asked Questions

Do I need Google Tag Manager to track forms in GA4?

No, but it is the most flexible option. You can also send events with code in your theme or through a plugin, though GTM keeps tracking changes outside your website files and gives you a built-in preview mode.

Which event name should I use for a contact form?

Use generate_lead if you want to follow Google’s recommended naming, or choose a descriptive custom name such as contact_form_submit. Avoid reusing form_submit if enhanced measurement is collecting it.

Why does my form track in Preview but not on the live site?

The usual causes are an unpublished GTM container version, a caching plugin serving an old page, an ad blocker or a consent banner that blocks analytics until the visitor accepts.

Can I track which page the form was submitted from?

Yes. GA4 automatically records the page location with every event, so you can see which pages generate the most submissions in your reports.

Final Thoughts

To track form submissions in GA4 reliably, match the method to your form, send only non-personal data, test in Preview and DebugView and mark the event as a key event. Once the data flows, you can build funnels, compare traffic sources and finally measure what your website really delivers.

Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.