HubSpot Form Tracking in GA4 (Step by Step)

How to track Hubspot Form Submissions in GA4

Stuck Finishing Your Website? I’ll Get It Live for You

I’m Kieran, and I’ve been building websites for businesses for over 20 years. If you’d rather someone just handle this for you, let’s have a quick chat.

Table of Contents

HubSpot Form Tracking With GTM and GA4

If you’re using HubSpot forms on your website and want to track when users submit those forms, integrating it with Google Analytics 4 (GA4) is a smart way to understand user behavior and measure conversions. GA4, combined with Google Tag Manager (GTM), gives you detailed insights into how users interact with your forms. In this post, we’ll guide you through the process of tracking HubSpot form submissions in GA4 using GTM.

Why Track HubSpot Form Submissions

Forms are critical for lead generation, user feedback, and contact inquiries. By tracking form submissions, you can:

  • Measure how effective your forms are in converting visitors.
  • Analyze where most form submissions are coming from.
  • Identify potential barriers or issues with form completion.
  • Gain insights into user behavior and optimize form placement.

Understanding the Tools You’ll Use

Before diving into the steps, here’s a quick breakdown of the tools involved:

  • Google Analytics 4 (GA4): GA4 is Google’s latest analytics platform that allows you to track various user interactions on your site, including form submissions.
  • Google Tag Manager (GTM): GTM is a free tool that simplifies tracking user interactions, such as clicks or form submissions, without needing to alter your website’s code directly.
  • HubSpot Forms: HubSpot forms are embedded on your website to capture user data such as names, emails, and other information.

Step-by-Step Guide to Track HubSpot Form Submissions in GA4

1. Set Up GA4 on Your Website

Before tracking form submissions, ensure you have GA4 properly set up on your website:

  1. Go to your GA4 account and create a Measurement ID.
  2. Add the GA4 tracking code to your website or configure it using GTM.
  3. Verify that data is being collected by checking the Realtime report in GA4.

2. Set Up Google Tag Manager (GTM)

Next, you’ll use GTM to track your HubSpot form’s submit button clicks:

  1. Create a GTM account and a container for your website.
  2. Add the GTM container code to your website’s header and body sections.

3. Identify Your HubSpot Form’s Submit Button

To track your HubSpot form, you need to identify the unique characteristics of the form’s submit button. Typically, HubSpot forms use a button with specific classes or IDs. For example, you might have a submit button like this in your form:

html
<input type="submit" class="hs-button primary large" value="Submit">

In this example, the submit button has a class of hs-button primary large and the button text (value) is "Submit". You’ll use this information to create a trigger in GTM.

4. Enable Click Variables in GTM

To track clicks on the submit button, first enable the necessary click variables in GTM:

  1. In your GTM container, go to Variables.
  2. Click Configure and enable the following built-in variables:
    • Click Classes
    • Click ID
    • Click Text

These variables will help identify when the specific submit button is clicked.

5. Create a Trigger to Track Button Clicks

Now, create a trigger in GTM that fires when the HubSpot form’s submit button is clicked:

  1. Go to Triggers in GTM and click New.
  2. Name the trigger something like HubSpot Form Submit Button Click.
  3. Select Click – All Elements as the trigger type.
  4. Configure the trigger to fire only on some clicks. Set the following conditions:
    • Click Classes contains "hs-button primary large".
    • Click Text equals "Submit".

This ensures that the trigger only fires when the specific HubSpot form submit button is clicked.

6. Create a GA4 Event Tag

Once the trigger is set up, you’ll create a tag to send the form submission event to GA4:

  1. Go to Tags in GTM and click New.
  2. Name the tag something like GA4 HubSpot Form Submit Event.
  3. Choose Google Analytics: GA4 Event as the tag type.
  4. Select your existing GA4 configuration tag (the one that contains your GA4 Measurement ID).
  5. In the Event Name field, enter "form_submit" or "hubspot_form_submit".
  6. Optionally, add parameters to pass extra information to GA4. For instance, you could pass:
    • Parameter Name: "button_class", Value: {{Click Classes}}.
    • Parameter Name: "button_text", Value: {{Click Text}}.
  7. Under Triggering, select the trigger you created earlier (e.g., HubSpot Form Submit Button Click).

7. Test the Setup in Preview Mode

Before publishing your tag, it’s crucial to test everything in GTM’s Preview Mode:

  1. In GTM, click Preview to enter Debug Mode.
  2. Enter your website’s URL and submit the HubSpot form.
  3. Check the GTM Debug panel to verify if your tag fires when the submit button is clicked.
  4. Confirm that the event appears in the GA4 Realtime report.

8. Publish the Tag

Once you’ve confirmed the tag works correctly in Preview Mode, it’s time to publish:

  1. In GTM, click Submit to publish the container.
  2. Your tracking is now live, and GA4 will start recording form submissions whenever someone clicks the submit button.

9. Monitor Events in GA4

After the tag is published, you can monitor the form submission data in GA4:

  1. Go to the Realtime or Events section in GA4.
  2. Look for the event name you configured (e.g., "form_submit").
  3. Analyze how many users are submitting the form, from which pages, and other user interactions.

Common Troubleshooting Tips

  • Form not being tracked: Double-check your GTM trigger conditions (like Click Classes or Click Text) to ensure they match the exact values of your HubSpot form’s submit button.
  • No data in GA4: Make sure your GA4 configuration tag is correctly set up and the correct Measurement ID is being used in your event tag.
  • Multiple forms on the page: If you have multiple forms, you may need to refine the trigger to target the specific form by using more specific IDs or classes.

Tracking HubSpot form submissions in GA4 is a powerful way to gain insights into your website’s user interactions and optimize for conversions. By using Google Tag Manager to track the form submit button, you can create a seamless integration between your HubSpot forms and GA4, helping you measure the effectiveness of your forms and make data-driven decisions.

With the steps outlined in this guide, you can confidently set up tracking for any HubSpot form on your website. Happy tracking!

Still stuck? Let's sort it in 15 minutes.
If you’d rather not wrestle with code, I’m happy to hop on a free 15- minute call to look at your site and tell you honestly whether you need help or whether it’s a five-minute fix.
Free Download
The 12-Point Website Health Checklist

The same checklist I use when auditing client sites. Speed, security, SEO basics, and the stuff most owners miss.

Custom Landing Pages Built For You
from €295
· 5-7 day turnaround