With Mouseflow, it's easy to track visitors that travel across several domains. The normal installation procedure tracks each of these domains separately. But, in some cases, it's better to have a combined recording for a cross domain visit. This is useful when hosting a landing page or checkout flow on a different domain from your main site.
The first step is to ensure both domains are added under "Domain" for the project in question. You can check this by picking the website you're interested, and clicking the "Settings" tab on the left hand side. Verify that both domains are listed in the "Domains" field. This will allow you to track both domains, and will generate two recordings - one for each domain. To combine these recordings, you'll need to alter the tracking code for each domain.
Change: You'll need to add this line to the start of the tracking code:
var mouseflowCrossDomainSupport = true;
Example:
<script type="text/javascript">
var mouseflowCrossDomainSupport = true;
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>
Once this is set up, visitors going from the first domain to the second should have one combined recording session.
Important notes
If you got pages with the same name on both domains, and you would like to differentiate between the page names in the Mouseflow recordings, then you can apply this string to the tracking code:
var mouseflowPath = window.location.hostname + window.location.pathname;
NB. It is important that the mouseflowPath
is loaded before rest of the tracking code, e.g.:
<script type="text/javascript">
var mouseflowPath = window.location.hostname + window.location.pathname;
var mouseflowCrossDomainSupport = true;
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>