Zopim Destination

Zendesk Chat, (previously called Zopim) is a live chat solution that helps businesses increase sales conversion by engaging important leads on their websites. The analytics.js Zendesk Chat Destination is open-source. You can browse the code on GitHub.

NOTE: Zendesk Chat currently offers two types of widgets: a standalone Chat Widget, which is mainly designed to provide chat related features, and a Web Widget, which incorporates both Zendesk Chat and Zendesk Support functionalities. At the moment, Segment only supports the Chat Widget. For more details refer to the “Getting Started” section below.

This document was last updated on June 11th, 2018. If you notice any gaps, outdated information or simply want to leave some feedback to help us improve our documentation, please let us know!

Getting Started

The first step is to make sure Zopim supports the source type and connection mode you’ve chosen to implement. You can learn more about what dictates the connection modes we support here.

WebMobileServer
📱 Device-based
☁️ Cloud-based
  1. From your Segment UI’s Destinations page click on “Add Destination”.
  2. Search for “Zopim” within the Destinations Catalog and confirm the Source you’d like to connect to. (This is the old name.)
  3. Add your Zendesk Chat ID (Zopim ID) to your Destination Settings. If you are using the Chat Widget, you can find your ID in the widget script itself. See example below:
<!--Start of Zendesk Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="https://v2.zopim.com/?[ZOPIM ID]";z.t=+new Date;$.
type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
</script>
<!--End of Zendesk Chat Script-->

If you are using the Web Widget (see example below), you will need to contact Zendesk Support in order to get your ID:

<!-- Start of Zendesk Widget script -->
<script>/*<![CDATA[*/window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(e){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var e=this.createElement("script");n&&(this.domain=n),e.id="js-iframe-async",e.src="https://assets.zendesk.com/embeddable_framework/main.js",this.t=+new Date,this.zendeskHost="SUBDOMAIN.zendesk.com",this.zEQueue=a,this.body.appendChild(e)},o.write('<body onload="document._l();">'),o.close()}();
/*]]>*/</script>
<!-- End of Zendesk Widget script -->
  1. In about 5-10 minutes the CDN updates and the Zendesk Chat snippet is initialized onto your page.

Identify

If you haven’t had a chance to review our spec, please take a look to understand what the Identify method does. An example call would look like:

analytics.identify('ze8rt1u89', {
  name: 'Zaphod Beeblebrox',
  email: 'Zaphod@hotmail.com',
  phone: '1-401-826-4421',
});

When you call identify, the name, email, and phone traits included in the call will be set to the current user in Zendesk Chat.

Record Live Chat Events

With this destination, you can automatically record track events for live chat conversations. If you select this option, we’ll collect the following events:

  • Live Chat Conversation Started
  • Live Chat Conversation Ended

These events will then flow out to your other tools, so you can do things like analyze if users who chat spend more money over time.

To learn more about the live chat events you can capture with this destination, head on over to our Live Chat spec docs.

Turn on Zendesk Chat

Troubleshooting

I want to hide the Zendesk Chat widget on certain pages, or after a analytics.js call is made.

Currently, the best way to ensure that the Zendesk Chat widget does not load on a page is to fire a small Javascript snippet as documented here on the legacy Zopim site. To ensure that the Zendesk Chat snippet fires after the library loads on the page, you can either wrap the snippet in an analytics.ready() method with any conditional logic you’d like, or place the script in the callback of any analytics.js (.track(), .identify(), etc) call so that it hides after that call is made.


Settings

Segment lets you change these destination settings via your Segment dashboard without having to touch any code.

Record live chat events.

Record Live Chat Conversation events from Zopim.

Zopim ID

To get your Zopim ID, please contact Zopim support: https://www.zopim.com/contact



Questions? Need help? Contact us!
Can we improve this doc?
Email us: docs-feedback@segment.com!