APIs & Integrations

ALe48
Member

Connect GA3 Tag to track form submission

SOLVE

Hello, 

 

I wanted to track form submission from Google Analytics, and the HubSpot form is embedded in the tracked website. I wonder if anyone can advise me on how to do this. I tried this method, and it's not working. Thank you.

 

Custom HTML tag with the Listener Code

<script type="text/javascript">
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>

0 Upvotes
1 Accepted solution
FarioConsulting
Solution
Top Contributor

Connect GA3 Tag to track form submission

SOLVE

Hi,

 

You could usie Google Tag Manager to track HubSpot form submissions in Google Analytics....Google Tag Manager can pass those events to Google Analytics

 

Hope this helps!

 

Cheers,
Harsh
Fario Consulting

View solution in original post

0 Upvotes
1 Reply 1
FarioConsulting
Solution
Top Contributor

Connect GA3 Tag to track form submission

SOLVE

Hi,

 

You could usie Google Tag Manager to track HubSpot form submissions in Google Analytics....Google Tag Manager can pass those events to Google Analytics

 

Hope this helps!

 

Cheers,
Harsh
Fario Consulting

0 Upvotes