Knowledge base | mouseflow

Kissmetrics Integration

With Mouseflow, it's easy to push in data from third-party services to extend the native segmentation/filtering capabilities.

To integrate with KISSmetrics, we can hook into "km_ai" cookie to track users by the Kissmetrics Anonymous ID in Mouseflow. This integration makes use of our Custom Variables feature.

This integration example uses the js-cookie library. Add it to your site by adding this line:

<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.4/js.cookie.min.js"></script>

Example:

<script type="text/javascript">

    var km_ai = Cookies.get('km_ai');

    // Mouseflow tracking code
    window._mfq = window._mfq || [];
    (function() {
        var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
        mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
        document.getElementsByTagName("head")[0].appendChild(mf);
    })();

    _mfq.push(["setVariable", "kissmetrics_id", km_ai]);
</script>

u can now filter the recording list by the kissmetrics_id variable -- pick kissmetrics_id as the key and enter a value for the ID, accordingly.