Knowledge base | mouseflow

LiveChat Integration

With Mouseflow, it's easy to seamlessly integrate into chat software like LiveChat. This integration will add the Mouseflow Playback Link to LiveChat.

Adding the playback URL to LiveChat

The code below is a replacement for your existing LiveChat code and adds the Mouseflow playback URL as a custom field (called mouseflow_url). You need to customize the 1234567 part with your own license shown in your original LiveChat code snippet. Once that's done, this snippet should be installed on all pages where you want to enable LiveChat:

<script type="text/javascript">
    window.__lc = window.__lc || {};
    window.__lc.license = 1234567;
    (function () {
        var lc = document.createElement('script');
        lc.type = 'text/javascript';
        lc.async = true;
        lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
            'cdn.livechatinc.com/tracking.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(lc, s);
    })();

    var LC_API = LC_API || {};

    LC_API.on_after_load = function () {

        window._mfq = window._mfq || [];
        _mfq.push(function () {
            var custom_variables = [{
                name: 'mouseflow_url',
                value: 'https://app.mouseflow.com/websites/' + mouseflow.websiteId +
                    '/recordings/' +
                    mouseflow.getSessionId() + '/play'
            }, ];

            LC_API.set_custom_variables(custom_variables);
        });

    };
</script>

Once this code is live, you should start seeing the mouseflow_url appear as a field in LiveChat.