Hubspot Form Tracking Event Listener

Conversion tracking for your Hubspot forms has never been easier. Automatically push detailed activity from your Regular and Popup into the data layer for easy measurement and analytics using Google Tag Manager.

How to track hubspot form submission with google tag manager

HubSpot Forms submissions can be tracked in a number of ways. Traditionally, it was acceptable to redirect users to a thank you page after submitting a form, and simple conversion tracking could be based on views of that thank you page. However, this creates a subpar user experience, lower quality data accuracy, and doesn’t allow you to scale your lead generation while still segmenting conversion data.

One alternative to using “thank you pages” is to fire events on form submissions directly to systems like Google Analytics. While this increases accuracy, consistency of tracking across multiple marketing platforms is hard to achieve as events for Google Analytics don’t carry over to other platforms.

<script>
window.addEventListener('message', function (event) {
try {
var data = JSON.parse(event.data);

if (data.event && event.origin === "https://mychart.uwhealth.org" || event.origin === "https://mychart-myc01.uwhealth.org") {
var dataLayer = window.dataLayer || (window.dataLayer = []);

dataLayer.push({
'event': data.event,
'postMessageData': data
});
}
} catch (e) {}
}, false);
</script>

Video of how to use the listener

Related Event Listener

Hubspot Form Tracking Event Listener

Conversion tracking for your Hubspot forms has never been easier. Automatically push detailed activity from your Regular and Popup into the data layer for easy measurement and analytics using Google Tag Manager.

Hubspot Form Tracking Event Listener

Conversion tracking for your Hubspot forms has never been easier. Automatically push detailed activity from your Regular and Popup into the data layer for easy measurement and analytics using Google Tag Manager.

Hubspot Form Tracking Event Listener

Conversion tracking for your Hubspot forms has never been easier. Automatically push detailed activity from your Regular and Popup into the data layer for easy measurement and analytics using Google Tag Manager.

download the google tag manager recipe for tracking hubspot action

we make you smarter with data

made with ❤️

The DumbData Team

Before you leave, try out these free tools.
FREE GA4 AUDIT TOOL & UTM AUDIT TOOL