Lead Capture Tools

Archwaydigital
Member

Google analytics event /goal tracking for hubspot forms & chat with google tag manager

SOLVE

Hi Everyone, 

 

I'm going slightly mad while trying to find a solution for tracking HubSpot forms and chats with Google Analytics & Google tag manager as a goal/event.

 

My config 

Tag:

 

<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>

 

Archwaydigital_1-1610145841613.png

 

Archwaydigital_0-1610145793397.png

Archwaydigital_2-1610145910442.png

I am unable to make it work... 

 

 

 

 

0 Upvotes
1 Accepted solution
KTownsend
Solution
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Google analytics event /goal tracking for hubspot forms & chat with google tag manager

SOLVE

Hi!

 

I found this post over on the development forum which might help in adding Google Analytics event tracking for a HubSpot form submission: https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submissi... 

 

I also found this article which might help with the Google Tag Manager set up: https://www.3whitehats.com/knowledge/tracking-hubspot-forms-google-tag-manager 

 

I hope this helps,

 

Katie Townsend

Inbound Executive 

BBD Boom

Katie Townsend - Acquisition Consultant at BBD Boom

View solution in original post

2 Replies 2
TGil
Participant

Google analytics event /goal tracking for hubspot forms & chat with google tag manager

SOLVE

And regarding the Chat actions? I´ve been not able to fully understand how to track actions on the live chat such as email submission and open chats.

KTownsend
Solution
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Google analytics event /goal tracking for hubspot forms & chat with google tag manager

SOLVE

Hi!

 

I found this post over on the development forum which might help in adding Google Analytics event tracking for a HubSpot form submission: https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submissi... 

 

I also found this article which might help with the Google Tag Manager set up: https://www.3whitehats.com/knowledge/tracking-hubspot-forms-google-tag-manager 

 

I hope this helps,

 

Katie Townsend

Inbound Executive 

BBD Boom

Katie Townsend - Acquisition Consultant at BBD Boom