Zoho: Difference between revisions
Jump to navigation
Jump to search
| (3 intermediate revisions by the same user not shown) | |||
| Line 14: | Line 14: | ||
var dataLayer = window.dataLayer || []; | var dataLayer = window.dataLayer || []; | ||
if (typeof visitId !== 'undefined') { | if (typeof visitId !== 'undefined') { | ||
dataLayer.push({'visitID' : visitId}) | |||
} | |||
dataLayer.push({'event' : 'zoho-' + eventName}); | dataLayer.push({'event' : 'zoho-' + eventName}); | ||
} | } | ||
jQuery(document).ready(function(){ | jQuery(document).ready(function(){ | ||
if (typeof $zoho !== 'undefined') { | |||
console.log( 'zoho hook started' ); | console.log( 'zoho hook started' ); | ||
$zoho.salesiq.visitor.chat(function(visitid,data) { zohoDataLayerEvent( 'visitor-chat', visitid ); }); | $zoho.salesiq.visitor.chat(function(visitid,data) { zohoDataLayerEvent( 'visitor-chat', visitid ); }); | ||
| Line 36: | Line 35: | ||
$zoho.salesiq.chat.accepttransfer(function(visitid,data) { zohoDataLayerEvent( 'chat-transfer-accepted' ); }); | $zoho.salesiq.chat.accepttransfer(function(visitid,data) { zohoDataLayerEvent( 'chat-transfer-accepted' ); }); | ||
$zoho.salesiq.chat.continue(function(visitid,data) { zohoDataLayerEvent( 'chat-continue' ); }); | $zoho.salesiq.chat.continue(function(visitid,data) { zohoDataLayerEvent( 'chat-continue' ); }); | ||
} | |||
}); | }); | ||
</script> | </script> | ||
| Line 43: | 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 | ||
zoho-chat-online – when visitor is on the page | <pre> | ||
zoho-chat-open – when the visitor opens the tab | zoho-chat-online – when visitor is on the page | ||
zoho-chat-start – when the visitor starts to use the chat | zoho-chat-open – when the visitor opens the tab | ||
visitor-chat - when the visitor writes a message | zoho-chat-start – when the visitor starts to use the chat | ||
zoho-chat-attend – when the agent has attended to the chat session | zoho-visitor-chat - when the visitor writes a message | ||
zoho-agent-message – when the agent has sent the visitor a message | zoho-chat-attend – when the agent has attended to the chat session | ||
zoho-chat-complete – the chat session is complete< | zoho-agent-message – when the agent has sent the visitor a message | ||
zoho-chat-complete – the chat session is complete | |||
</pre> | |||
Latest revision as of 12:50, 16 May 2023
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 zoho-chat-open – when the visitor opens the tab zoho-chat-start – when the visitor starts to use the chat zoho-visitor-chat - when the visitor writes a message zoho-chat-attend – when the agent has attended to the chat session zoho-agent-message – when the agent has sent the visitor a message zoho-chat-complete – the chat session is complete