Are you looking to track Hubspot forms without the option of using a thank you page?
That’s Great! Watch this 5 minute video I created. Learn step by step and track your own Hubspot forms using Google Tag Manager and Google Analytics.
Here is the code you will need to create the event listener code.
<script type="text/javascript"> window.addEventListener("message", function(event) { if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') { window.dataLayer.push({ 'event': 'hubspot-form-data', 'hs-form-guid': event.data.id, 'hs-formData': event.data.data }); } }); 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>