Mouseflow gives you complete control over what visitors get recorded. For example, you can record only visitors who enter your site through a specific landing page or Entry Page.

Setup

To only track visits from specific visitors, we can include a check for the Entry Page in the Mouseflow Tracking Code.


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. Add the JSS-cookie library to your site

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

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

3. Modify your Mouseflow Tracking Script

To ensure that you only record visitors coming from your chosen Entry Page you will have to replace your existing tracking code with something that follows this format:

Example

<script type="text/javascript">
window._mfq = window._mfq || [];
var entryPageToRecord = "/entry-page.html";

function activateMouseflow() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.defer = true;
mf.src = "//cdn.mouseflow.com/projects/INSERT-YOUR-WEBSITE-ID.js";
document.getElementsByTagName("head")[0].appendChild(mf);
};

var mfEntryPageCookie = Cookies.get('mf_entrypage');
if (mfEntryPageCookie === null || mfEntryPageCookie === undefined) {
Cookies.set('mf_entrypage', document.location.pathname);
mfEntryPageCookie = document.location.pathname;
}

if (mfEntryPageCookie === entryPageToRecord) {
activateMouseflow();
}
</script>

Notes
- You need to customize the path to the entry page (in this case "/entry-page" above).
- The URL on the "mf.src" line must be customized to match the tracking code in your account.
- You should always test this to make sure it has the desired functionality.

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 will begin on the entry page you've chosen.

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?