Lead Capture Tools

TTran33
Member

Unable to track form submission in GTM for Hubspot form

Hi,

 

I tried to track form submissions of a Hubspot form embedded on my Wordpress website, but it doesn't work. I can't seem to find an official document about this from Hubspot. Could you please let me know how can I set this up correctly?

 

This is how the form being embedded to my website:

<div class="custom-hs-form"><script src="https://js.hsforms.net/forms/embed/47139258.js" defer></script>
<div class="hs-form-frame" data-region="na1" data-form-id="70988fc1-c644-45a8-9c0d-9c148f4ceb52" data-portal-id="47139258"></div>
</div>

0 Upvotes
6 Replies 6
labriana
Member

Unable to track form submission in GTM for Hubspot form

Hello, did you manage to find a solution? I have the same problem

0 Upvotes
VPathania
Top Contributor

Unable to track form submission in GTM for Hubspot form

Have you tried creating a custom event in GTM to track the form submissions? You’ll also need to set up a GA4 event tag for it. Just checking if you've already tried this.

0 Upvotes
Sjardo
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Unable to track form submission in GTM for Hubspot form

Hi, 

 

Some questions:

What do you mean that you try to track it in GTM? As GTM is more like a middle man towards other software.

I think this topic should help you out with an accepted solution: https://community.hubspot.com/t5/Reporting-Analytics/Tracking-forms-in-GTM/m-p/646263

Sjardo

HubSpot CMS Developer at Bikkelhart.com

Send a message!

Did my post help answer your question? Mark this as a solution.

0 Upvotes
TTran33
Member

Unable to track form submission in GTM for Hubspot form

I mean I tried to set up conversion tracking with Google Tag Manager.

 

If you mean the link provided in the topic might help (https://nettlesnet.com/track-hubspot-forms-with-google-tag-manager-analytics/), I actually followed that instruction but it didn't work.

 

Thanks for replying to my question. Please let me know if you need any further clarification from me.

0 Upvotes
VPathania
Top Contributor

Unable to track form submission in GTM for Hubspot form

0 Upvotes
TTran33
Member

Unable to track form submission in GTM for Hubspot form

Thanks for replying. The link you provided suggested the same method with the one I mentioned.

 

I added the below HTML tag. However, there was no 'hubspot-form-success' event pushed. 

---

<script type="text/javascript">
window.addEventListener("message", function(event) {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted') {
window.dataLayer.push({
'event': 'hubspot-form-success',
'hs-form-guid': event.data.id
});
}
});
</script>

 

----

Would it be possible that the way I embedded the form causes this to not work?

0 Upvotes