Most of the replies so far have involved using the Conversations API event listeners.
@derekcavaliero’s reply being the accepted solution.
I just wanted to add to this that HubSpot have now introduced a `contactAssociated` event.
I have just implemented a usage for this to push an AdWords conversion event when triggered by our Chat Flow setup which asked for name and email, thus creating/associating a contact from the chat user. We are considering this as conversion rather than just starting a chat conversation.
An approximation of what I implemented:
function onConversationsAPIReady() {
window.HubSpotConversations.on('conversationStarted', function(payload){
//console.log("HubSpot Conversation Started");
// Do something here to track if necessary
});
window.HubSpotConversations.on('contactAssociated', function(payload){
//console.log("HubSpot Contact Associated");
// Do whatever you like here to track
if(typeof window.gtag === 'function'){
//Event snippet for Chat Contact Associated conversion page
window.gtag('event', 'conversion', {'send_to': 'YOUR/CONVERSION/ID/HERE'});
}
});
}
Hope this helps!