Hello! I want to track only successful form submissions on the website. They are created in HubSpot and added on the website using JavaScript. We don’t have a thank you page, but a thank you message displayed in the same box as the form is. How can this be done as in GTM with the hs-form-guide Data layer, but adapted to MTM?
2 Likes
I also would like to know that.
We’ve resorted to running a script found on Hubspot forum some time back.
It loads in a tag on pageview. Not ideal but it works for us.
<script>
window.addEventListener("message", function(event) {
if(event.data.type === 'hsFormCallback' && event.data.eventName === "onFormSubmit" ) {
_paq.push(['trackEvent', 'HS Form', 'Form submited', '"']);
}
});
</script>