Mouseflow Help & Support

Record Visitors Based on Entry Page

With Mouseflow, you can determine whether to record visitors based on a specific entry page. This requires the use of cookies and JavaScript to conditionally include the tracking code.

First, download and install the jQuery Cookie Plugin.

Then, replace your existing tracking code with something that follows this format:

<script type="text/javascript"> 
var entryPageToRecord = "/entry-page.html";

(function($) {
$.activateMouseflow = function() {
console.log('Function start');
var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
mf.src = "//";
}; var mfEntryPageCookie = $.cookie('mf_entrypage');
if (mfEntryPageCookie === null || mfEntryPageCookie === undefined) {
$.cookie('mf_entrypage', document.location.pathname);
mfEntryPageCookie = document.location.pathname;
console.log('Function End');

if (mfEntryPageCookie == entryPageToRecord) {


  • 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.


If you have questions or need help, feel free to open a ticket or call us at +1 (855) 668-7335.

Tags: cookies javascript jquery

Have more questions? Submit a request


  • Avatar
    Rosinvest Realstate

    Please help me with the below queries..

    1. Do i need to add the page url directly or any code that relates to the entry page ? How i need to add entry page like "/" or "/" ?

    2. Tracking code means which code? Is it my analytics code or mouse flow code which i received at the beginning of my account creation?



  • Avatar
    Morten Hornbaek

    1: You should enter URL of thee entry page to in the first line of the example:

    var entryPageToRecord = "/entry-page";

    You should note that we don't use the full URL, but only the pathname. So with your example ('') you should enter:

    var entryPageToRecord = "/page1=sample&rent"

    Also, if the entrypage in question uses querystrings - such as - you will need to change some lines in the example:

    This first line should be:

    var entryPageToRecord = "/?query=string"

    And these two lines:

    $.cookie('mf_entrypage', document.location.pathname);

    mfEntryPageCookie = document.location.pathname;

    Should be changed to:

    $.cookie('mf_entrypage', document.location.pathname +;

    mfEntryPageCookie = document.location.pathname +;

    2: The tracking code we mention is the Mouseflow tracking code you received when you created your project. Is should be replaced by the this example, once it has been personalized (you need to add your own website-ID to replace the '123.js' in the example.