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


To only track visits from Facebook, we can check whether the referrer URL contains Facebook.


Example

<script type="text/javascript">
    if (document.referrer.indexOf('facebook.com') > -1) document.cookie = 'mf_record_user=1';

    if (document.cookie.indexOf('mf_record_user=1;') > -1) {
        // Mouseflow Tracking Snippet goes here...
    }
</script>

Please note that each new visit will only be captured if it originates from Facebook.