Mouseflow gives you complete control over what visitors get recorded. For example, you can choose to only record visitors who perform a specific action - like logging in, adding an item to the cart, or simply clicking a button.

Setup

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


Modify your Mouseflow Tracking Script

  1. Prevent recording by adding var mouseflowAutoStart = false to the top of your tracking snippet just after the opening <script> tag.
  2. Next, use JavaScript to assign either true or false to the shouldRecord variable. In this example, we will record all visitors who visit a the page /page-to-record.

Example

<script type="text/javascript">
var mouseflowAutoStart = false;

var shouldRecord = window.location.pathname === "/page-to-record";

if (shouldRecord) {
document.cookie = "mf_record=1;path=/";
}

if (document.cookie.indexOf("mf_record=1;") {
mouseflowAutoStart = true;
}

window._mfq = window._mfq || [];
(function() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.defer = true;
mf.src = "//cdn.mouseflow.com/projects/<WEBSITE_ID>.js";
document.getElementsByTagName("head")[0].appendChild(mf);
})();
</script>

Make sure to replace <WEBSITE_ID> with your website ID. This can be found in your website settings.

Did this answer your question?