Skip to content

Instantly share code, notes, and snippets.

@ryanpraski
Last active October 28, 2019 20:29
Show Gist options
  • Save ryanpraski/60dc1f465b2290bfc23214caea4220ad to your computer and use it in GitHub Desktop.
Save ryanpraski/60dc1f465b2290bfc23214caea4220ad to your computer and use it in GitHub Desktop.
Zendesk chat formerly know as Zopim chat connected, chat start, chat end tracking in Adobe Launch and Google Tag Manager (GTM). See more events for the chat api here: https://api.zopim.com/files/meshim/widget/controllers/LiveChatAPI-js.html
try {
$(document).ready(function() {
if (typeof zE != 'undefined') {
zE(function() {
$zopim(function() {
$zopim.livechat.setOnConnected(function() {
//console.log("zendesk chat connected");
//trigger();
_satellite.track('zendeskChatConnected');
dataLayer.push({
'event': 'zendeskChatConnected',
});
})
})
$zopim(function() {
$zopim.livechat.setOnChatStart(function() {
//console.log("zendesk chat started");
//trigger();
_satellite.track('zendeskChatStart');
dataLayer.push({
'event': 'zendeskChatStart',
});
})
})
$zopim(function() {
$zopim.livechat.setOnChatEnd(function() {
//console.log("zendesk chat ended");
//trigger();
_satellite.track('zendeskChatEnd');
dataLayer.push({
'event': 'zendeskChatEnd',
});
})
})
});
}
});
} catch (err) {
console.log(err.message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment