Mouseflow gives you complete control over what 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.

1. Log in to your site and locate your Mouseflow Tracking Script

You will usually find your tracking script in the backend of your website.

2. Modify your Mouseflow Tracking Script

To ensure that you only record visitors coming from Facebook you will have to add the snippet below to your Mouseflow Tracking code:

if (document.referrer.indexOf('') > -1) { 
localStorage.setItem('mf_record_user', '1');

if (localStorage.getItem('mf_record_user')){
// Mouseflow Tracking Snippet goes here...

An example of the modified Tracking Code would look as follows:

<script type="text/javascript">
if (document.referrer.indexOf('') > -1) {
localStorage.setItem('mf_record_user', '1');

if (localStorage.getItem('mf_record_user')){ {
// mouseflow tracking code
window._mfq = window._mfq || [];
(function() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.defer = true;
mf.src = "//";

Once you've successfully updated your tracking code on all pages where you want the change to apply, please make sure to save your changes to the code.

When you've saved the changes you should begin seeing that all the recordings you get into Mouseflow originate from Facebook.

Note: Due to browser caching changes to the Tracking Code and Recording Script may take up to 48 hours to take full effect.

Did this answer your question?