I have been trying to track Hubspot Livechat on Google Tag Manager (GTM). More specifically people who are coming from Google Ads then click the Livechat.
Is there any way to do that? I asked Hubspot Support, but apparently there is no way to do that from Hubspot.
<script type="text/javascript">
function onConversationsAPIReady() {
//console.log("HubSpot Conversations API Available");
window.HubSpotConversations.on( 'conversationStarted', function( payload ) {
//console.log("HubSpot Conversation Started");
window.dataLayer.push({
'event': 'hubspot-conversation-started',
'hs-conversation-id': payload.conversation.conversationId
})
});
}
/*
If external API methods are already available, use them.
*/
if (window.HubSpotConversations) {
onConversationsAPIReady();
} else {
/*
Otherwise, callbacks can be added to the hsConversationsOnReady on the window object.
These callbacks will be called once the external API has been initialized.
*/
window.hsConversationsOnReady = [onConversationsAPIReady];
}
</script>
Hi, I wanted to share that I have used the API recipe from @acgorecki (link is his comment) and added it into GTM, and it works!! Thank you very much for this @acgorecki , I am now able to track conversations that have started as a goal in GA.
In that case, I don't know of a way to track clicks which open the live chat widget. hubspot-messages-iframe-container is one of the few div elements outside the iframe.
I certainly see value in tracking custom interactions with the live chat tool, however. I recommend upvoting and commenting on this HubSpot Community Idea and any other topics which match your use case to help them become realities.
This information is sent directly to our Product team and helps prioritize feature requests that have the greatest impact on our customers. I’ve already upvoted the idea and will also do my part and pass your feedback along through internal channels.
I would like to know if there are updates on a way to track the chat with Google Tag Manager. Unfortunately, the only solution indicated does not work.