Track Hubspot Forms with Google Tag Manager

Updated: Friday, June 6, 2025

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.

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
Custom HTML tag to add the Hubspot form listener
Custom HTML tag to add the Hubspot form listener

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.

Generate_lead event in Data Layer
Generate_lead event in Data Layer

Create the corresponding Data Layer variables

Form identifier

Retrieve the form_id in the Data Layer
Retrieve the form_id in the Data Layer

Form fields

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

Recover form fields in the Data Layer
Recover form fields in the Data Layer

Going further

You can send the user data collected via your Hubspot form to advertising platforms to improve your performance: