Tracking Hubspot Form Submissions in GA4 for Reporting
Tracking Hubspot form submissions in GA4 is important for the purpose of measuring campaign and source traffic effectiveness in driving site conversions, so you know what is working—and what isn’t. Unfortunately, Hubspot lacks this feature natively. Common solutions involve a simple tagging method using a submission “thank you” page triggered by page view. While effective, this method isn’t bullet-proof and is subject to false-positives in conversions with issues like page refresh and multiple submissions from existing customers.
Using custom scripting and multiple tags triggering custom events through Google Tag Manager (GTM), I was able to not only identify and track true conversions, but also enable the option to import the form ID into Google Analytics 4 (GA4) for comparative testing between certain form types on the site (e.g., modal window pop-up vs. on-page embedded).
This complex solution required a multi-step configuration in GTM, in which I:
- Created a tag with a custom HTML script listener to trigger on all pages of the site to capture key form values.
- Created custom triggers mapped to Hubspot to capture data layer values.
Custom Event Tag
User-defined Data Layer Variable
- Created a GA4 event tag to push event and form ID to GA4 with an event parameter. This event is triggered by the custom script listener tag.
- Created a custom definition in GA4 to track by form ID and marked generate_lead as a conversion for proper tracking.
JACS Solutions now has the ability to track Web form leads as conversions in reporting, as well as the ability to drill-down to see the effectiveness at the form level. This created a much smoother way in which to present monthly conversion results and offered more in-depth reporting of the top-of-funnel lead generation as a metric that can be attributed to campaigns and traffic sources.