Mouseflow Help & Support

Zopim Integration

Follow

With Mouseflow, it's easy to seamlessly integrate into chat software like Zopim. You can do the integration both ways, either adding the playback URL to the chat session inside Zopim, or add customer details from Zopim into the Mouseflow session. Let's go through both options here.

Adding the playback URL to Zopim

Zopim has a JavaScript API that lets you add notes to the chat session. The code below shows you how to add the playback URL as a note in Zopim.

<script type="text/javascript">

window._mfq = window._mfq || []; _mfq.push(
$zopim(function() {
$zopim.livechat.setNotes('Mouseflow session: https://app.mouseflow.com/websites/' +
mouseflow.websiteId + '/recordings/' + mouseflow.getSessionId() + '/play');
})
);
</script>

What happens in the code is the following:

  1. We make sure the _mfq variable is available. This is the variable that is used to communicate with the Mouseflow object.
  2. We call _mfq.push( ... ) to make sure the inner function is called when Mouseflow's context is fully loaded.
  3. We call $zopim( ... ) to make sure Zopim's livechat object is fully loaded.
  4. We call $zopim.livechat.setNotes( ... ) to add the playback URL as a note. The note will contain the text "Mouseflow session: " and then the playback URL (requires that you are logged into your Mouseflow account)

Adding customer data from Zopim into Mouseflow

Zopim also has a way to get customer details through their JavaScript API. We'll show you how to use this data to send to Mouseflow. See the code example below.

<script type="text/javascript">

_mfq = _mfq || [];
$zopim(function() {
var zopimEmail = $zopim.livechat.getEmail();
if (zopimEmail)
_mfq.push(["setVariable", "zopim_email", details.emailAddress]);
});

</script>

The above code checks if the Zopim livechat object has an email address registered, and if so, adds it as a custom variable to Mouseflow. You can see all the "get" methods here. To enhance this integration further, you can use the above email address to identify the user directly in Mouseflow. This is done like this:

<script type="text/javascript">

_mfq = _mfq || [];
$zopim(function() {
var zopimEmail = $zopim.livechat.getEmail();
if (zopimEmail)
_mfq.push(["identify", zopimEmail]);
});

</script>

 

Tags: integrate zopim third party service custom variables

Have more questions? Submit a request

Comments

Powered by Zendesk