Track HubSpot Pop Up Forms in Tag Manager

Hi,

I’m trying to track hubspot pop up forms in Google Tag Manager but GTm but not having any luck.

I have the listener script setup below.

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

I tried setting the trigger to when the pop up is visible (using element visibility trigger) but that also didn’t seem to work.

Any help is appreciated.

Hi, @CHutt5 :waving_hand: Thanks for your question. Did you get this resolved? If not, I’ll be happy to tag some community members who have GTM expertise.

Best,

Jaycee

Hi @Jaycee_Lewis,

Thanks for your response,

Unfortunately not, still looking for a solution.

That would be great, thanks.