Table of Contents
Tracking HubSpot forms in Google Analytics 4 is important for measuring lead quality, form performance, and conversion rate. But HubSpot forms are often embedded in iframes, which means GA4 cannot detect form submissions automatically.
Both methods work seamlessly with Google Tag Manager (GTM).
Method 1: Track HubSpot Forms Using onFormSubmit Callback (Recommended)
This is the most accurate and reliable method because:
✔ It works with embedded forms
✔ It works even if you use iframes
✔ It fires on 100% of valid form submissions
HubSpot provides a built-in JavaScript callback called onFormSubmit, which we will use to push an event into the dataLayer, and then send it to GA4.
Step 1: Add HubSpot on FormSubmit Listener in GTM
In Google Tag Manager, go to Tags → New

2. Choose Custom HTML

3. Paste this code:

4. Trigger → DOM Ready

5. Save the tag as:
HubSpot – onFormSubmit Listener

Step 2: Create Custom Event Trigger
1. Go to Triggers → New

2. Choose Custom Event

3. Event Name: hubspot_form_submit
4. Name the trigger: HubSpot – Form Submit Trigger
5. Save

Step 3: Create GA4 Event Tag
1. Go to Tags → New

2. Choose Google Analytics: GA4 Event

3. Event Name: hubspot_form_submit

4. Under Triggering → Select: HubSpot – Form Submit Trigger

5. Save the tag as: GA4 – HubSpot Form Submission


Step 4: Test in GTM Preview Mode
- Click Preview
- Submit your HubSpot form


- In the left panel, look for:
- hubspot_form_submit event

- hubspot_form_submit event
- Confirm your GA4 tag fired
Step 5: Verify in GA4 DebugView
1. Open GA4
2. Go to Admin → DebugView

3. Submit the form again
4. Look for the event:
hubspot_form_submit

Method 2 (Optional): Track HubSpot Form Redirect to Thank You Page
If your HubSpot form redirects to a thank-you page (e.g., /thank-you/), you can simply track that page as a conversion.
Step 1: Create Thank You Page Trigger
1. Go to Triggers → New
2. Choose Page View → Some Page Views
Condition:
Page URL → contains → thank-you
3. Save as:
HubSpot – Thank You Page Trigger
Step 2: Create GA4 Event Tag
1. Go to Tags → New
2. Select GA4 Event
Event Name:
hubspot_form_submit
3. Trigger → HubSpot – Thank You Page Trigger
4. Save
Conclusion
You now have the setup using:
✔ HubSpot onFormSubmit callback (most accurate)
✔ Optional thank you page tracking
This ensures your HubSpot forms are tracked correctly in GA4 without guesswork or unreliable triggers.
Want Professional Tracking Setup?
Connect with Incisive Ranking
At Incisive Ranking, we implement:
- GA4
- HubSpot tracking
- Server-side tagging
- CRO & advanced analytics
If you want your form tracking to be 100% accurate, we can set it up for you.




