I'm trying to track HubSpot Form submissions as events in Google Analytics. Really, I'm using Google Tag Manager, hoping to pass the event information to Google Analytics
Here's where I'm running into an issue:
The HubSpot form is implemented through a time-based lightbox popup (Convert Plus).
In GTM, the tag trigger is set up on Trigger Type: Form Submission firing on Form ID.
In this case, I've tried both the HubSpot form's ID and the lightbox container's ID (because why not).
I've also tried setting it to fire on Click URL with the target page (an online PDF.)
With that said, the form tag still doesn't appear in the GTM preview panel.
Now, I've seen these posts on GA events and HubSpot forms but I haven't attempted any of them because 1. I'll admit I'm out of my depth here, and 2. The lightbox popup manager is throwing me for a loop when it comes to embed codes.
Due to how Hubspot forms work the built in form submission listener in GTM won't work; you have to actually litsen for Hubspot's particular submission callback to track it. Here's a step-by-step on creating a custom listener for tracking hubspot form submissions with GTM:
If you want to track only a particular form you can just add && event.data.id === "[your form GUID here]" to the end of the if statement in the form listener tag the instructions have you add. Like so :
Like amwilie mentioned, you'll need to listen to events coming from the iframe but...you don't really need to understand any of that. Just copy-paste the code in that blog post to your site.
@DDemagistris You can follow these instructions for setting up a tag for Google Ads conversion then just use the hubspot-form-success trigger as the trigger for the tag.
@simeoned Unfortanutely Hubspot does not store the form title in anyway in the form code or listener so there's no way to access it easily. You would have to use the forms API to search for it by it's guid and then get the name that way. API's aren't my strong suit but I think it'd be something like this?
@factsetresearch@juanjosezg You would have to keep track of form fields interacted with and then probably use an exit intent trigger. It would work ok if the person stays in the tab and leaves the page, but I don't think a script would be able to run quick enough to capture when someone closes the tab. I think it'd be a little complex so don't currently have the time to throw some code here for you but if I get some free time I'll see what I can put together.
If this answer solved your question, please mark it as the solution.
@alyssamwilie I've followed all the steps for setting up conversion tracking between hubspot and Google Ads in GTM. I do have one problem though, it seems like the Google Ads Conversion Tag is firing as a successful conversion even when someone hasn't filled in all required fields but tried sending in the form.
Basically it seems they're firing on Form Submit while they should only fire on Form Submitted.
What I'm worried about is that this will distort our conversion data in Google Ads when people try sending in a complete form. We've hade some correct conversions where we see 1 form submission in HubSpot while it's being counted as 1 conversion in Google Ads. But we also hade 3 conversions one day in Google Ads, but no form submissions at all in HubSpot. So I'm really worried this might happen from time to time if we don't find the cause to this.
Do you know why this could be? Or if you think it has to do with something else?
This is my set up:
Tags firing when I haven't filled in alla required fields, but tried sending in the form
and after that when I send in the form with all required fields filled in I get a form success message with the correct Form ID etc which would count as a conversion.
@RTeuchler Due to the way Hubspot forms work you can't use GA's Form Submission trigger to accurately log form submissions. Follow the instructions exactly in the link I provided in my solution answer to create a variable for the form guid and a custom event trigger that looks for the data the form listener pushes.
If this answer solved your question, please mark it as the solution.
Due to how Hubspot forms work the built in form submission listener in GTM won't work; you have to actually litsen for Hubspot's particular submission callback to track it. Here's a step-by-step on creating a custom listener for tracking hubspot form submissions with GTM:
If you want to track only a particular form you can just add && event.data.id === "[your form GUID here]" to the end of the if statement in the form listener tag the instructions have you add. Like so :
Could you please help me with a thing i have noticed? I have setup the event listener for form submission parsed the form name parameter towards the event, and somehow I do not see the data in google analytics 4. I am wondering because I have internal traffic excluded? How about someone who has submitted a newsletter signup via hubspot form, i have checked the gtm and my event is triggered correctly in tag assistant, when i debug, but the new person who has signed up to my newsletter is not counted in google analytics on the 23rd of march, when i received an email from hubspot saying they have registered a new sign up. please help. i am confused. Any help would be appreciated.
Can you please advise on a way to modify the lisener, the variable, or both to include the name of the HS form itself? We wamt to set up goal tracking so that the label has something human readable for reporting purposes. Right now it just has "{{Forms — hs-form-guid}}".
We want to roll up all the different form submissions from all the different forms into the same goal in GA but be able to distinguish between which ones got sent. So...
Category: button
Action: Submit
Label: {{hs-form-name}}
Would be ideal. Again, what would need to be modified in the listener/variable to accomplish this?