With Mouseflow, it's easy to control which visitors get recorded. For example, you can record visitors who find your website through a Bing Ad.


To only track visits from Bing Ads, we can check for the "msclkid" (MSN Click ID).


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">
    if (window.location.href.indexOf('msclkid') > -1) { 
        Cookies.set('mf_record_user', 1, 10); 
    }

    if (Cookies.get('mf_record_user')) {

        // 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);
        })();
    }
</script>

Each new visit will only be captured if it originates from Bing Ads (with a msclkid URL parameter).