Zopim Chat Event Listener

Enhance your measurement by tracking how users interact with your Zopim Chat widget. These Zopim Chat event listeners push the chat activity into the DataLayer and can be used in Google Tag Manager to trigger your tags/pixels.

How to track Zopim Chat Interactions with google tag manager

Using Google Tag Manager and this event listener script, you can track Zopim chat activity and have the data available in your analytics stack, Google Analytics, Piwik Pro, Mixpanel, Fullstory, Amplitude, etc.

To achieve this, you’ll have to copy this Zopim Chat event listener script and paste it into a new custom HTML tag type in Google Tag Manager, and add a trigger to fire the code on pageview or DOM ready (recommended).

💡 Pro Tip: fire on DOM ready if you implemented the Zopim chat widget through GTM).

The next step is to create a dataLayer variable [zopimChatAction] which tells us what chat activity occurred.

After creating the variable, you should create a custom event trigger with the event name [zopimChat], which fires on every Zopim chat activity.

The event captures chat activities like;

  1. The user starts a chat
  2. The user closed a chat
  3. The Zopim chat widget is visible (expanded)
  4. The Zopim chat widget gets minimized

Now that you’ve created the trigger, you can now link your marketing tags to this trigger and use the [zopimChatAction] dataLayer variable, to dynamically capture the activity type that happened.

🏆 Credit:

The original code creator is Julius Fedorovicius (we only extended the number of actions the script can track)

 

<script>
$zopim(function() {
$zopim.livechat.setOnChatStart(function() {
// trigger when chat starts
window.dataLayer.push({
"event": "zopimChat",
"zopimChatAction": "zopim Chat Started"
});
});
$zopim.livechat.setOnChatEnd(function() {
// trigger when chat closes
window.dataLayer.push({
"event": "zopimChat",
"zopimChatAction": "zopim Chat Closed"
});
});
$zopim.livechat.window.onShow(function() {
// trigger when the chat window is shown
window.dataLayer.push({
"event": "zopimChat",
"zopimChatAction": "zopim Chat Visible"
});
});
$zopim.livechat.window.onHide(function() {
// trigger when the chat window is shown
window.dataLayer.push({
"event": "zopimChat",
"zopimChatAction": "zopim Chat Hidden"
});
});
});
</script>

Video of how to use the listener

Related Event Listener

Intercom

Track when users interact with your intercom chat widget and fire your marketing tags/pixels when these interactions happen.

Ninja Form

This event listener makes it possible for you to track Ninja Form submission and trigger your pixels/tags when there is a conversion.

Drift

Event listener script that helps you track Drift chat interactions that happen on your website, easily and seamlessly.

download the google tag manager recipe for tracking Zopim Chat Interactions

we make you smarter with data

made with ❤️

The DumbData Team
Before you leave, try out these free tools.
FREE GA4 AUDIT TOOL & UTM AUDIT TOOL