Knowledge base | mouseflow

Testing Multiple Versions of a Website (A/B Testing)

You can use Mouseflow with A/B testing or with multivariate (MVT) testing tools. Put simply, Mouseflow can record sessions for multiple versions of a website. All you need to do is add a line of JavaScript code that alters how Mouseflow tracks the page’s path (e.g. www.website.com/home/pg1/stuff).

Let’s say you want to test two versions of your homepage - version A and version B. If you’re testing version A, then you tell Mouseflow that the path will be:

/home/ver-A

Or if it’s version B:

/home/ver-B

You will now see that '/home/ver-A' and '/home/ver-B' appear in the recording and page analysis lists.

Example:

<script type="text/javascript">
    var mouseflowPath = "/landingpage/version-a";

    // Replace variable pageVersion with the one you use in your own system
    if (pageVersion === "B") 
        mouseflowPath = "/landingpage/version-b";

    window._mfq = window._mfq || [];
        (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);
        })();
</script>