Introduction
Tracking form submissions—such as “Contact Us” or “Request a Quote” forms—is critical for measuring the success of marketing campaigns. While you could hardcode Google Analytics tracking directly into your website’s HTML, using Google Tag Manager (GTM) is far more scalable and doesn’t require developer intervention for every change. This guide explains how to use GTM to detect form submissions and send that data to Google Analytics 4 (GA4) as a conversion event.
Prerequisites
Ensure you have both a Google Analytics 4 property and a Google Tag Manager container created. The GTM container snippet must be installed on all pages of your website. Your GA4 Configuration tag must also be active in GTM.
Step 1: Enable Built-In Form Variables
By default, GTM does not track the specifics of form elements. You must enable the built-in variables to capture this data.
- Log in to Google Tag Manager and select your workspace.
- Click on Variables in the left-hand menu.
- Under the Built-In Variables section, click Configure.
- Scroll down to the Forms section and check all the boxes:
Form Classes,Form Element,Form ID,Form Target,Form Text, andForm URL.
Step 2: Create a Form Submission Trigger
Next, you need to tell GTM when to fire a tag. We do this by creating a trigger that listens for a form submission.
- Navigate to Triggers in the left menu and click New.
- Name the trigger (e.g., “Trigger – Contact Form Submission”).
- Click the Trigger Configuration box.
- Under the User Engagement category, select Form Submission.
- If you only have one form on your site, you can leave it set to All Forms. If you have multiple forms, select Some Forms and set a condition (e.g.,
Form IDequalscontact-us-form). - Click Save.
Pro Tip: Checking the “Check Validation” box ensures the trigger only fires if the form is successfully submitted, ignoring validation errors where the user forgets a required field.
Step 3: Create the GA4 Event Tag
Now that GTM knows when the form is submitted, you must create a tag that sends the event data to GA4.
- Navigate to Tags and click New.
- Name the tag (e.g., “GA4 Event – Form Submit”).
- Click Tag Configuration and select Google Analytics: GA4 Event.
- Select your existing GA4 Configuration tag from the dropdown menu (or enter your Measurement ID manually).
- In the Event Name field, type exactly what you want the event to be called in GA4, such as
generate_leadorform_submission. - Scroll down to the Triggering section.
- Select the “Trigger – Contact Form Submission” you created in Step 2.
- Click Save.
Step 4: Test with Preview Mode
Never publish changes without testing them first.
- Click the Preview button in the top right corner of the GTM workspace.
- Enter your website URL to launch the Tag Assistant debug window.
- Navigate to your contact page and submit a test form.
- Look at the Tag Assistant window. On the left side, you should see a
gtm.formSubmitevent. Click on it. - In the Tags Fired section, verify that your “GA4 Event – Form Submit” tag successfully fired.
Step 5: Publish the Container
Once you confirm the tag fires correctly, return to the GTM workspace and click Submit. Add a descriptive version name (e.g., “Added form submission tracking”) and click Publish. The data will begin populating in your GA4 Realtime reports immediately.