Google Tag Manager
Track Hubspot Forms with Google Tag Manager
Questions about this article?
Open it in your AI assistant to summarise it or apply it to your setup.
Hubspot forms
Forms created with Hubspot are difficult to track with Google Tag Manager’s native triggers.
I’ll show you how to track only valid submissions of a Hubspot form, and also how to get user data (such as email address) to send to advertising platforms.
This video is blocked
You haven't accepted YouTube cookies. Allow them to watch the video.
Install Hubspot Form listener
To listen for valid Hubspot form submissions, you need to fill in the form below to get the full code of the Hubspot Form Listener to add to Google Tag Manager with a custom HTML tag.
1if(typeof HubspotFormsV4 != 'undefined') {
2 window.addEventListener("hs-form-event:on-submission:success", function(event) {
3// Fill in the form below to access full working code
Sent! Check your inbox

I recommend to trigger this tag only on the page(s) that contain Hubspot forms.
Example of a valid form submission
On a valid form submission, the generate_lead event is sent to the Data Layer.
If you have several forms on the same page, you’ll need to use the form_id variable to differentiate them in GTM.

Create the corresponding Data Layer variables
Form identifier

Form fields
Here you need to create a variable for each field of your form.

Going further
You can send the user data collected via your Hubspot form to advertising platforms to improve your performance:
Let's talk about your tracking
A question about this article, need an audit of your setup or server-side migration? Drop me a line, I reply within 24h.
Prefer to talk it through? Book a discovery call →


Comments
Join the discussion
A question, some feedback, a specific case? Leave a comment: I reply to every one.