How to Track HubSpot Forms in Google Analytics
You’ve done the hard work of creating a great offer and building a beautiful HubSpot form on your site to capture leads. The submissions are rolling in, and you can see them neatly logged in your HubSpot portal. But when you look at your Google Analytics 4 reports, that conversion activity is a black box, making it impossible to see which marketing channels, campaigns, or pages are actually driving those valuable sign-ups. This article will show you exactly how to solve that problem and start tracking HubSpot form submissions as conversions in Google Analytics 4.
Why Bother Tracking HubSpot Forms in GA4?
Connecting these two platforms isn't just a technical exercise, it's about gaining critical marketing insights. When HubSpot form submissions appear as conversion events in GA4, you unlock the ability to:
- Attribute Conversions Accurately: Finally see which traffic sources (Organic Search, Paid Social, Email, Referral) are bringing in the most form fills. Are your Google Ads campaigns actually converting, or is your organic blog content the real hero?
- Understand the Full User Journey: Map out the steps users take before they convert. You can see which pages they viewed and how they engaged with your site, giving you valuable clues about what content helps move visitors from curious prospects to engaged leads.
- Optimize Your Marketing Spend: When you know which channels drive conversions, you can double down on what works and cut wasted ad spend on campaigns that only generate clicks but no leads.
- Build Custom Audiences: You can create remarketing audiences in GA4 and Google Ads based on users who have completed a form, allowing you to re-engage them with new offers or exclude them from future lead-generation campaigns.
In short, it closes the loop between your marketing efforts and your business results.
Method 1: The 'Thank You' Page Redirect (The Easiest & Most Reliable Way)
The simplest and most popular method for tracking form submissions is to redirect users to a unique "thank you" page after they fill out the form. You then tell Google Analytics to count a pageview of this special page as a conversion event. It's clean, simple, and requires no code.
Step 1: Create a Dedicated 'Thank You' Page
First, you need a unique destination for users after they submit the form. This page serves no other purpose, ensuring that anyone who lands on it must have come from a successful form submission.
- In your CMS (like WordPress, Webflow, or the HubSpot CMS), create a new page. You can name it something simple like "Thank You for Contacting Us," or "Download Your Guide."
- The URL slug should be descriptive, like
/thank-youor/guide-download-confirmation. Make a note of this URL, you'll need it soon. - Important Tip: Add a 'noindex' meta tag to this page. This tells search engines like Google not to show your thank you page in search results. You only want people to find this page by filling out your form, not by searching for it.
On this page, confirm their submission was successful and provide next steps or the resource they signed up for ("Your ebook is on its way to your inbox!").
Step 2: Set Up a Conversion Event In Google Analytics 4
Next, you’ll configure GA4 to recognize a visit to your new thank you page as a specific conversion event.
- Log in to your Google Analytics 4 property.
- Click on the Admin gear icon in the bottom-left corner.
- In the Property column, click on Events.
- Click the Create event button, and then click Create again on the next screen.
- Now you'll define the rules for a custom event. Here’s how to fill out the configuration:
- Click Create in the top-right. Your new event is now active and will start tracking whenever someone visits the thank you page.
- Finally, to make this an official "conversion," navigate to Admin > Conversions. After about 24 hours, you should see your new custom event (e.g.,
generate_lead) appear in the list. Simply toggle the switch next to it to mark it as a conversion.
Step 3: Redirect Your HubSpot Form to the 'Thank You' Page
The final step is to connect the form to the destination page.
- In your HubSpot account, go to Marketing > Hubspot Forms.
- Find and edit the form you want to track.
- Click on the Options tab.
- Under the "What should happen after a visitor submits this form?" section, select Redirect to another page.
- Click the Add Link dropdown and choose "URL."
- Paste the full URL of the thank you page you created in Step 1 (e.g.,
https://www.yourwebsite.com/thank-you). - Save and Publish your form.
That's it! Now, every time someone fills out your form, they'll be sent to your thank you page, which will trigger the generate_lead event you configured in GA4 and count it as a conversion.
Method 2: Using Google Tag Manager (The Advanced & Flexible Way)
What if you don't want to use a thank you page? Maybe you prefer to just show an inline message like "Thanks for your submission!" without a page reload. In this case, Google Tag Manager (GTM) is your answer. This method is more technical but gives you more control and flexibility.
This approach involves using a small piece of code that "listens" for HubSpot form submission events and then pushes that info into GTM's data layer, which GTM can then use to fire a GA4 tag.
Step 1: Add a Listener Script to Your Website
First, you need to add a script to your site that can detect when a HubSpot form has been successfully submitted. You can add this directly to your website's footer or, ideally, deploy it as a "Custom HTML" tag in GTM that fires on all pages.
Here's a commonly used script that does the job:
<script type="text/javascript">
window.addEventListener("message", function(event) {
if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
window.dataLayer.push({
'event': 'hubspot_form_success',
'hs_form_guid': event.data.id
}),
}
}),
</script>This script listens for the 'onFormSubmit' message from the HubSpot form and then pushes an event named hubspot_form_success to the GTM data layer, along with the form's unique ID.
Step 2: Create a Trigger in Google Tag Manager
Now, tell GTM when to fire your tracking tag. The trigger is the hubspot_form_success event from the script you just added.
- In GTM, go to Triggers and click New.
- Name your trigger something like "HubSpot Form Success."
- Under Trigger Configuration, choose the trigger type Custom Event.
- For the Event name, enter
hubspot_form_success. It has to match the event name in your script exactly. - Leave it set to "All Custom Events."
- Save the trigger.
Step 3: Create The GA4 Event Tag in GTM
The final GTM step is to create the tag that sends the information to Google Analytics 4 when your trigger fires.
- Go to Tags and click New.
- Name your tag "GA4 Event - HubSpot Form Submission."
- Under Tag Configuration, choose Google Analytics: GA4 Event.
- Select your main GA4 Configuration Tag. (If you don't have one, you'll need to set one up with your GA4 Measurement ID first).
- For the Event Name, type in the same name you decided on earlier, like
generate_lead. - Under "Triggering," select the "HubSpot Form Success" trigger you created in the previous step.
- Save the tag.
After creating the tag, click the Submit button in the top-right corner of GTM to publish your changes.
Which Method Should You Choose?
- Use the 'Thank You' Page Method if: You're less technical, want the most surefire way to track submissions, or want a dedicated page to upsell or provide next steps to new leads. It’s simple and very hard to break.
- Use the Google Tag Manager Method if: You prefer to use inline thank you messages, manage dozens of forms and want more granular control, or you're already comfortable working inside GTM. It's more flexible and scalable but involves more moving parts.
Final Thoughts
Tracking HubSpot forms in Google Analytics is an essential step for connecting your lead generation efforts to your overall marketing analytics. Whether you use the simple thank you page method or the more advanced Google Tag Manager approach, closing this data loop will give you the clarity needed to make smarter decisions about your website, content, and ad campaigns.
Setting this up is a fantastic move, but it often illuminates another challenge: your data is scattered everywhere. You've got form data in HubSpot, traffic data in GA4, ad spend in Facebook Ads Manager, and sales data in your CRM. At Graphed, we built a solution for exactly this problem. We make it easy to connect all your data sources in one place and then use simple, natural language to create real-time dashboards and reports. Instead of wrangling tools, you can just ask, "Show me a dashboard of my HubSpot form submissions by traffic source from Google Analytics," and get an answer in seconds.
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.