How to track form submissions with Google Tag Manager

Author:

Tracking form submissions with Google Tag Manager (GTM) is crucial for understanding user interactions on your website, optimizing conversion rates, and measuring the effectiveness of your marketing efforts. By implementing form submission tracking, you can collect valuable data on how users engage with your forms, whether they are contact forms, sign-up forms, or checkout forms. Below is a step-by-step guide on how to set up form submission tracking using Google Tag Manager.

Step-by-Step Guide to Track Form Submissions with Google Tag Manager

1. Set Up Google Tag Manager

If you haven’t already set up GTM on your website, follow these initial steps:

  1. Create a GTM Account:
    • Go to the Google Tag Manager website and sign in with your Google account.
    • Click “Create Account,” enter your account name, and create a container for your website.
  2. Install the GTM Code:
    • GTM will provide you with a container code snippet after creating your account.
    • Copy and paste this code into the <head> and <body> sections of your website as instructed.

2. Enable Built-In Variables for Forms

To track form submissions, ensure that GTM’s built-in variables for forms are enabled.

  1. Access Variables:
    • Click on the “Variables” section in the left sidebar of your GTM account.
  2. Configure Built-In Variables:
    • Click the “Configure” button in the Built-In Variables section.
    • Enable the following variables:
      • Form Classes
      • Form ID
      • Form Target
      • Form URL
    • These variables will allow you to capture specific information about the forms being submitted.

3. Create a Trigger for Form Submissions

Next, create a trigger that will fire when a form is submitted.

  1. Create a New Trigger:
    • Click on the “Triggers” section in the left sidebar.
    • Click the “New” button to create a new trigger.
  2. Configure the Trigger:
    • Click on “Trigger Configuration” and select “Form Submission.”
    • Under “This trigger fires on,” choose “Some Forms” to specify the conditions for the trigger to fire.
  3. Set Conditions for the Trigger:
    • Set the conditions based on the attributes of the form you want to track. For example:
      • If you want to track forms with a specific ID:
        • Choose Form ID from the dropdown menu, select equals, and enter the form ID (e.g., contact-form).
      • If you want to track forms based on a class:
        • Choose Form Classes, select contains, and enter the class name of the form (e.g., signup-form).
    • You can combine multiple conditions for more specific tracking.
  4. Name Your Trigger:
    • Give your trigger a descriptive name (e.g., “Form Submission Trigger”) and click “Save.”

4. Create a Tag for Form Submission Tracking

Now, create a tag that will send data to Google Analytics when a form is submitted.

  1. Create a New Tag:
    • Click on the “Tags” section in the left sidebar.
    • Click the “New” button to create a new tag.
  2. Configure the Tag:
    • Click on “Tag Configuration” and select “Google Analytics: Universal Analytics” (or “Google Analytics 4” if you are using the latest version).
    • Track Type: Choose “Event.”
    • Category: Enter a category name (e.g., Form Submission).
    • Action: Use a variable to dynamically capture the form ID or name. For example, select Form ID or Form Classes as the Action value.
    • Label: Optionally, use a variable to capture additional information (like Form URL).
  3. Select Google Analytics Settings:
    • Choose your Google Analytics settings variable from the dropdown or create a new one with your Tracking ID.

5. Link the Trigger to the Tag

  1. Assign the Trigger:
    • Under the “Triggering” section of the tag configuration, click on the “+” icon to add the trigger you created for form submissions.
    • Select the trigger you named (e.g., “Form Submission Trigger”).
  2. Name Your Tag:
    • Give your tag a descriptive name (e.g., “GA Form Submission Tag”) and click “Save.”

6. Preview and Debug Your Setup

Before publishing your changes, it’s essential to test your setup.

  1. Enter Preview Mode:
    • Click on the “Preview” button in the top right corner of the GTM interface.
    • Enter your website URL to test the tracking implementation.
  2. Test Form Submissions:
    • Navigate to your website and submit the form you’re tracking.
    • Check the debug panel to ensure that the form submission tag fires correctly when you submit the form. You should see the tag listed under the relevant events.
  3. Verify Data in Google Analytics:
    • Open your Google Analytics account and check the Real-Time reports to see if form submission events are being tracked as expected.

7. Publish Your Changes

Once you’ve confirmed that the form submission tracking is functioning correctly:

  1. Click on Submit:
    • In the GTM interface, click the “Submit” button in the top right corner.
  2. Add a Version Name and Description:
    • Enter a version name and description for your changes (e.g., “Form Submission Tracking Setup”).
  3. Click Publish:
    • Click the “Publish” button to make your changes live.

8. Monitor and Analyze Form Submission Data

After publishing your changes, monitor the data in Google Analytics:

  1. Access Google Analytics:
    • Log in to your Google Analytics account.
  2. View Event Reports:
    • Navigate to Behavior > Events > Top Events to see the data collected from your form submissions.
    • Analyze the data to understand user engagement and conversion rates associated with your forms.

Best Practices for Form Submission Tracking

  • Use Descriptive Names: When naming tags and triggers, use clear and descriptive names that reflect their purpose.
  • Test Thoroughly: Always test your implementation in Preview Mode to ensure everything is working correctly before publishing.
  • Combine with Other Tracking: Consider tracking additional interactions (like button clicks or page views) for a comprehensive understanding of user behavior.
  • Regularly Review Data: Periodically review the collected data to identify trends and optimize your forms for better conversion rates.

Conclusion

Tracking form submissions with Google Tag Manager is a straightforward process that provides valuable insights into user interactions on your website. By following the steps outlined in this guide, you can successfully implement form submission tracking, monitor user engagement, and make data-driven decisions to enhance your site’s performance. Regularly review your tracking setup and data to ensure your analytics implementation remains effective and aligned with your goals.