Hubspot Live Chat Event Listener
How to track Hubspot Live Chat Interactions with google tag manager
Measuring how users interact with your Hubspot live chat widget is easy and seamless using this Hubspot chat event listener and Google Tag Manager.
To track these interactions, start by creating a custom HTML tag in GTM, copy and paste this event listener code in that tag and trigger it on all pageview or DOM Ready (Recommended)
💡 Pro Tip: fire on DOM ready if you implemented the Crisp chat widget through GTM).
Your next step is to create two custom event triggers with event names;
[conversationBegan] –> when user starts a conversation
[conversationClosed] –> when a user ends a conversation
These data make it possible to analyze the impact of the live chat on your user experience, business funnels, conversions and other business KPIs.
You can connect your marketing tags to the appropriate triggers, and BOOM! you are now tracking this event and sending the data where you need it. (Always remember to DEBUG!!!)
🏆 Credit: Hubspot Created the code framework, which can be found here
<script type="text/javascript"> function onConversationsAPIReady() { window.HubSpotConversations.on("conversationStarted", function() { dataLayer.push({ event: "conversationBegan" }); }); window.HubSpotConversations.on("conversationClosed", function() { dataLayer.push({ event: "conversationClosed" }); }); } window.HubSpotConversations ? onConversationsAPIReady() : (window.hsConversationsOnReady = window.hsConversationsOnReady || [], window.hsConversationsOnReady.push(onConversationsAPIReady)); </script>