CMS Development

CHutt5
Member

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.

0 Upvotes
2 Replies 2
Jaycee_Lewis
Community Manager
Community Manager

Track HubSpot Pop Up Forms in Tag Manager

Hi, @CHutt5 👋 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

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
CHutt5
Member

Track HubSpot Pop Up Forms in Tag Manager

Hi @Jaycee_Lewis,

 

Thanks for your response,

 

Unfortunately not, still looking for a solution.

 

That would be great, thanks.

0 Upvotes