Cross-domain tracking allows Mouseflow to track a user's session across multiple domain names where Mouseflow has been installed.

Enabling Cross-Domain tracking is required if you are tracking a user's journey across multiple domains. For example, their journey may start from a hosted landing page or lead to a checkout flow, where the domain name is not your main domain.

How to enable Cross-domain Tracking

First, ensure that all domains have been added under the Domains section in your Settings:

Next, navigate to the Apps & Integrations section for your website and click the Cross-Domain Support app:

Then, enable the app:

Once configured, visitors going from the first domain to the second domain will have one combined recording session.

Important notes

  • Enabling the Cross-Domain Support integration will also change how the URLs are displayed in your recordings and heatmaps to include the full domain name. If for example, Mouseflow used to display your home page as just "/" it will now display the homepage as "www.yourdomain.com/". These changes will not apply retrospectively to existing recordings and heatmaps.
    

  • Cross-Domain Support will only work for navigation in the same window/tab. If the visitor opens the second page in a new tab, window, or browser, two separate recordings will be generated.

  • Cross-Domain Support will only work for direct navigation from one domain to the other. So the Mouseflow tracking code needs to be on the last page of domain 1 and the first page of domain 2.

  • With the Cross-Domain integration enabled, you will need to change the rules applied under forms, funnels, etc. to match how the page path is being recorded in the application from that point on (to include the full domain name).

Advanced

If you need full control of the code or the display URLs, then you can add the following string to your Mouseflow tracking code:

var mouseflowPath = window.location.hostname + window.location.pathname;

Important notes

  • It is required that the mouseflowPath is loaded before the rest of the tracking code, for example:

<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.defer = true;
mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
document.getElementsByTagName("head")[0].appendChild(mf);
})();
</script>

  • If you're using a tag manager, you'll need to deploy Mouseflow and any modifications to the Mouseflow code, via a custom HTML snippet/tag. Here is how to customize the Mouseflow tracking code in Google Tag Manager (GTM)

Did this answer your question?