HubSpot Chat: Difference between revisions

From Growth Agency Wiki
Jump to navigation Jump to search
No edit summary
 
Line 16: Line 16:
</script>
</script>
</pre>
</pre>
*Note: may need to be put in DOM ready so it loads after the chat

Latest revision as of 13:40, 31 August 2022

Tracking In Tag Manager

https://community.hubspot.com/t5/Reporting-Analytics/HubSpot-Chat-amp-Google-Analytics-Event-Tracking/m-p/370205

<script type="text/javascript">
  window.addEventListener("load", function(){
	window.HubSpotConversations.on('conversationStarted', function(payload){
	    // ga('send', 'event', 'Beacon', 'chat-started', 'Hubspot');
		window.dataLayer.push({
			'event': 'hubspot-chat-started',
			'hs-chat-id': payload.conversation.conversationId
		});
	});
  });
</script>
  • Note: may need to be put in DOM ready so it loads after the chat