With Mouseflow, tracking subdomains is simple.

If your website uses subdomains (i.e. subdomain.example.com) as an extension of the main domain (ex. certain pages are hosted on the subdomain but still act as part of the main website), simply follow the steps below:

  1. Sign in to your Mouseflow account.
  4. Add the subdomain in the "Domains" field.
  5. Click "Save".

This will make Mouseflow accept pages from both domains. If you want to track two domains separately, you have to register the other domain as a separate website. Otherwise all visits and analytics will be combined.

If you have multiple domains listed under the "Domain(s)" section, please note that if they share the same path (i.e. 'mywebsite.com/example/' and 'shop.mywebsite.com/example'), all of their data will be combined. You can get around this by setting a virtual path using the mouseflowPath variable.

You could use a conditional JavaScript statement such as this:

if (document.domain === "shop.mywebsite.com") { 
    var mouseflowPath = "shop.mywebsite.com" + window.location.pathname; 

That would ensure that all visits to 'shop.mywebsite.com' would be saved in an individual map in the page analysis list, shown with the subdomain in front of that path. You would need to set the mouseflowPath variable before the tracking code was loaded - preferably at the start of the tracking code, such as this: 

<script type="text/javascript">
    if (document.domain == "shop.mywebsite.com") { 
        var mouseflowPath = "shop.mywebsite.com" + window.location.pathname; 
    window._mfq = window._mfq || [];
    (function() {
        mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";