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>
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
I mean I tried to set up conversion tracking with Google Tag Manager.
If you mean the link provided in the topic might help (Track Hubspot Form Submissions with Google Tag Manager and Analytics | NettlesNET ), 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.
The above shared link is not accessible to me. But, below links contain information on this:
How to track HubSpot form submissions using Google Tag Manager, report form submissions as events in Google Analytics 4, and optimise Google Ads HubSpot forms
Est. reading time: 5 minutes
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?
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.
Hello, did you manage to find a solution? I have the same problem