Mouseflow Help & Support

Start Recordings Based on User Actions

Follow

With Mouseflow, 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.

This requires the use of cookies and JavaScript to conditionally include the tracking code. The examples below rely on jQuery and the jQuery Cookie Plugin — you'll need to have both installed on your website.

In the example below, we are starting recordings when the HTML element with the ID 'example' is clicked. This condition can of course be changed to whatever suits you.

Example:

<script type="text/javascript">
var activateMouseflow = function() {
var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
document.getElementsByTagName("head")[0].appendChild(mf);
};

// Action to trigger Mouseflow here:
$( "#example" ).click(function() {
$.cookie('mf_start', '1');
activateMouseflow();
});

if ($.cookie('mf_start') == '1') {
activateMouseflow();
}
</script>


Notes

  •  The URL on the "mf.src" line must be customized to match the tracking code in your account.
  •  You should always test these examples to make sure they have the desired functionality.

 

Tags: start recording user action click login

Have more questions? Submit a request

Comments

Powered by Zendesk