Zoho: Difference between revisions
Jump to navigation
Jump to search
| Line 42: | Line 42: | ||
*note we do not use the "$zoho.salesiq.ready" as it is unreliable via tag manager | *note we do not use the "$zoho.salesiq.ready" as it is unreliable via tag manager | ||
<pre> | |||
zoho-chat-online – when visitor is on the page<br /> | zoho-chat-online – when visitor is on the page<br /> | ||
zoho-chat-open – when the visitor opens the tab<br /> | zoho-chat-open – when the visitor opens the tab<br /> | ||
| Line 49: | Line 50: | ||
zoho-agent-message – when the agent has sent the visitor a message<br /> | zoho-agent-message – when the agent has sent the visitor a message<br /> | ||
zoho-chat-complete – the chat session is complete<br /> | zoho-chat-complete – the chat session is complete<br /> | ||
</pre> | |||
Revision as of 12:48, 15 August 2022
Tracking In Tag Manager
Zoho has an API for tracking.
https://www.zoho.com/salesiq/help/developer-section/js-api.html
To use this, create a custom HTML tag In tag manager and trigger it on any pages the Zoho chat runs on.
Add this script to the custom HTML:
<script>
function zohoDataLayerEvent( eventName, visitId ) {
var dataLayer = window.dataLayer || [];
if (typeof visitId !== 'undefined') {
dataLayer.push({'visitID' : visitId})
}
dataLayer.push({'event' : 'zoho-' + eventName});
}
jQuery(document).ready(function(){
if (typeof $zoho !== 'undefined') {
console.log( 'zoho hook started' );
$zoho.salesiq.visitor.chat(function(visitid,data) { zohoDataLayerEvent( 'visitor-chat', visitid ); });
$zoho.salesiq.floatbutton.click(function() { zohoDataLayerEvent( 'chat-open' ); });
$zoho.salesiq.chatbutton.click(function() { zohoDataLayerEvent( 'chat-start' ); });
$zoho.salesiq.chat.online(function(){ zohoDataLayerEvent( 'chat-online' ); });
$zoho.salesiq.chat.offline(function(){ zohoDataLayerEvent( 'chat-offline' ); });
$zoho.salesiq.chat.attend(function(visitid,data){ zohoDataLayerEvent( 'chat-attend', visitid ); });
$zoho.salesiq.chat.agentMessage(function(visitid,data){ zohoDataLayerEvent( 'agent-message', visitid ); });
$zoho.salesiq.chat.complete(function(visitid,data){ zohoDataLayerEvent( 'chat-complete', visitid ); });
$zoho.salesiq.chat.transferchat(function(visitid,data) { zohoDataLayerEvent( 'chat-tranferred' ); });
$zoho.salesiq.chat.accepttransfer(function(visitid,data) { zohoDataLayerEvent( 'chat-transfer-accepted' ); });
$zoho.salesiq.chat.continue(function(visitid,data) { zohoDataLayerEvent( 'chat-continue' ); });
}
});
</script>
- note we do not use the "$zoho.salesiq.ready" as it is unreliable via tag manager
zoho-chat-online – when visitor is on the page<br /> zoho-chat-open – when the visitor opens the tab<br /> zoho-chat-start – when the visitor starts to use the chat<br /> zoho-visitor-chat - when the visitor writes a message<br /> zoho-chat-attend – when the agent has attended to the chat session<br /> zoho-agent-message – when the agent has sent the visitor a message<br /> zoho-chat-complete – the chat session is complete<br />