Mouseflow Help & Support

How do I track websites with subdomains?

Follow

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.
  2. Pick the website you're interested in from the drop down menu next to the "Help" tab.
  3. Click the "Settings" tab on the left hand side.
  4. Add the subdomain in the "Domains" field.
  5. Click "Save".
  6. 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" + document.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" + document.location.pathname; };
var _mfq = _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>

 

Tags: tracking subdomain include subdomain installing subdomain

Have more questions? Submit a request

Comments

Powered by Zendesk