How to Track Any Form in GA4 Using GTM

Learn how to track any form submission in GA4 using Google Tag Manager. Simple step-by-step guide with examples for HubSpot, Elementor, and more.

Tagassists

Author

Table of Contents

Forms are one of the most important conversion points on any website. However, many businesses assume their form submissions are being tracked correctly — when in reality, Google Analytics 4 misses a large number of modern form submissions. This results in inaccurate lead counts, confusing reports, poor ad optimization, and wasted marketing spend. Accurate form tracking is essential for understanding true lead volume, optimizing paid ads, and calculating real ROI. Without reliable data, it’s impossible to scale what’s actually working.

The problem is that GA4’s built-in tracking only supports very basic HTML forms. Most popular tools like HubSpot, Elementor, Webflow, and Shopify use AJAX or iframe-based submissions, which GA4 does not track automatically.

In this guide, you’ll learn how GA4 form tracking really works, a simple 3-step method to track any form using GTM, ready-to-use examples for popular form builders, and the most common mistakes to avoid — so your conversion data finally reflects reality.

What You Need Before Starting?

Before you begin, make sure you have:

  • Access to Google Analytics 4
  • Google Tag Manager installed on your website
  • Basic idea of how GTM works

No advanced coding needed.

How Form Tracking Works in GA4 (Simple Explanation)

GA4 doesn’t understand “forms”. GA4 only understands events. So to track a form, we need to:

  • Detect when a form is successfully submitted
  • Send an event to GA4
  • Count that event as a conversion

The 3-Step Process to Track Any Form in GA4 Using GTM

Tracking form submissions in GA4 can be confusing, especially when you’re dealing with different form builders like Elementor, HubSpot, custom HTML forms, or AJAX-based forms. Instead of relying on unreliable page-view or thank-you page tracking, the most accurate approach is to track form submissions using Google Tag Manager with a dataLayer event.

Below is a simple 3-step process that works for any form type and gives you clean, reliable form submission data in GA4.

Step 1 — Send a dataLayer Event When the Form Is Submitted

When the form is completed successfully, send this data:

				
					window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "form_submit",
  form_name: "contact_form"
});

				
			

This tells GTM and GA4: “A real form submission just happened.”

Step 2 — Catch the Event in Google Tag Manager

Inside GTM:

  • Create a Custom Event Trigger
  • Event name: form_submit

This trigger will fire only when the form is submitted.

Step 3 — Send the Event to GA4

Create a GA4 Event Tag:

  • Event name: form_submit
  • Send form_name as a parameter

Publish your GTM container.

Ready-to-Use dataLayer Examples for Popular Forms

Different form builders handle submissions in different ways, which is why a single tracking method doesn’t always work. Some forms submit via callbacks, others use AJAX, and many never reload the page at all.

To make GA4 tracking accurate and consistent, you need form-specific dataLayer implementations that fire only after a successful submission. Below are ready-to-use examples for popular form builders like HubSpot and Elementor, so you can plug them in and start tracking immediately using GTM and GA4.

HubSpot Form Tracking (GA4 + GTM)

HubSpot forms allow a successful callback. Use this:

				
					window.addEventListener("message", function(event) {
    if(!(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted')) return;

    window.dataLayer = window.dataLayer || [];
    dataLayer.push({
        event: 'hubspot_form_submit',
        formId: event.data.id,
        conversionId: event.data.data.conversionId,
        formGuid: event.data.data.formGuid,
        inputs: event.data.data.submissionValues
    });
});

				
			

This sends a clean event to GTM every time the form is submitted.

Elementor Form Tracking (GA4 + GTM)

Go to: Custom JS in the Tag Manager and Paste this:

				
					<script>
(function() {
    var origXMLHttpRequest = XMLHttpRequest;
    XMLHttpRequest = function() {
        var requestURL;
        var requestMethod;
        var requestBody;

        var xhr = new origXMLHttpRequest();
        var origOpen = xhr.open;
        var origSend = xhr.send;

        xhr.open = function(method, url) {
            requestURL = url;
            requestMethod = method;
            return origOpen.apply(this, arguments);
        };

        xhr.send = function(data) {
            if (/.+\/admin-ajax\.php/.test(requestURL)) {
                xhr.addEventListener('load', function() {
                    if (xhr.readyState === 4 && xhr.status === 200) {
                        var response;
                        try {
                            response = JSON.parse(xhr.responseText);
                        } catch (e) {
                            return;
                        }

                        if (response && response.success && data && typeof FormData !== 'undefined' && data instanceof FormData) {
                            requestBody = {};
                            data.forEach(function(value, key) {
                                requestBody[key] = value;
                            });

                            if (requestBody.action === "elementor_pro_forms_send_form") {
                                window.dataLayer = window.dataLayer || [];
                                window.dataLayer.push({
                                    event: 'elementor_form_submit',
                                    inputs: requestBody
                                });
                            }
                        }
                    }
                });
            }

            return origSend.apply(this, arguments);
        };

        return xhr;
    };
})();

</script>

				
			

Now every Elementor form submission is trackable.

How to Set This Up in Google Tag Manager?

Once your dataLayer events are firing correctly from the form, the final step is configuring Google Tag Manager and GA4 to receive and record those events. This setup ensures every successful form submission is tracked as an event—and optionally counted as a conversion—inside GA4. Follow the steps below to complete the configuration.

1. Create a Custom Event Trigger

  • Trigger type: Custom Event
  • Event name: form_submit

2. Create a GA4 Event Tag

  • Tag type: GA4 Event
  • Event name: form_submit
  • Parameters: form_name

Attach the trigger and save.

3. Mark the Event as a Conversion in GA4

In GA4:

  • Go to Admin → Events
  • Turn on Conversion for form_submit

Forms You Can Track Using This Method

This setup works for almost all forms, including:

Why Some Forms Need Custom Tracking

Many modern website forms—such as Elementor, HubSpot, and custom-built forms—do not behave like traditional forms. These forms often:

  • Do not reload the page
  • Use AJAX
  • Run inside iFrames

Because of this, click-based or page-view tracking fails in GA4, leading to inaccurate data. That’s why dataLayer-based form tracking using Google Tag Manager is the most reliable method—it triggers events only after a successful form submission and works with all modern form types.

Common Form Tracking Mistakes to Avoid

One of the biggest reasons form tracking fails in GA4 is incorrect setup in Google Tag Manager. Avoid these common mistakes to keep your data accurate:

Tracking button clicks instead of real submissions: A click doesn’t always mean the form was successfully submitted, especially for AJAX forms.

Creating duplicate events in GTM or GA: This can inflate your conversion numbers and make reports unreliable.

Using different event names across dataLayer, GTM, and GA4: Event name consistency is critical for proper tracking.

Not testing before publishing: Always test using GTM Preview mode and GA4 DebugView to confirm events and parameters are firing correctly.

Track Form Submissions for Ads Too

Once your GA4 form submission event is set up using Google Tag Manager, you can reuse the same event across multiple advertising platforms to track real leads instead of clicks.

Google Ads: Import the GA4 conversion or fire a Google Ads conversion tag to track actual form submissions.

Meta (Facebook) Ads: Send Lead or custom conversion events through GTM for accurate campaign attribution.

LinkedIn Ads: Measure B2B leads by triggering LinkedIn Insight Tag conversions on form submission.

Microsoft (Bing) Ads: Use the same form event to track conversions without additional setup.

How Tagassists Helps You Track Forms the Right Way?

Setting up form tracking in GA4 and Google Tag Manager is not always easy. Many forms use AJAX or iFrames, and a wrong setup can lead to missing or incorrect data.

Tagassists helps you track form submissions the right way. We set up clean, dataLayer-based tracking so you can see real form submissions, not just button clicks.

We also connect the same events to Google Ads, Meta (Facebook), LinkedIn, and Microsoft Ads, so you know which campaigns are bringing real leads.

Beyond form tracking, we can help with full analytics setup, including GA4 configuration, event tracking, and conversion tracking. Whether it’s one form or your complete analytics setup, Tagassists focuses on simple setup, accurate data, and results you can trust.

Need Help Setting Up Form Tracking?

Request a Free Tracking Audit or Schedule a Meeting with Tagassists.

Final Thoughts

Tracking form submissions accurately is essential for understanding your website’s performance and measuring real leads. With GA4 and Google Tag Manager, you can track any form—whether it’s built with HubSpot, Elementor, or custom code—without relying on unreliable page reloads or button clicks.

Using dataLayer-based tracking ensures your events are precise, consistent, and ready to use for analytics and ad platforms like Google Ads, Meta, LinkedIn, and Microsoft Ads.

If you want to make sure your forms are tracked correctly and your analytics setup is clean, Tagassists can help. From single form tracking to full GA4 and GTM configuration, we focus on accuracy, simplicity, and results you can trust.

Start tracking your real leads today and make better data-driven decisions for your business.

Frequently Asked Questions (FAQ)

Does GA4 automatically track form submissions?
No. Most modern forms need custom setup.

What event name should I use?
form_submit or generate_lead are good choices.

Can one GTM trigger track all forms?
Yes, if you pass a form_name parameter.

How do I check if it’s working?

You can Use:

  • GTM Preview
  • GA4 DebugView
  • Real-time reports

Get Your Free Audit

Scroll to Top