Tracking across subdomains
Track a site that spans several subdomains, such as www, app, blog or shop, and understand how Muro counts visitors across them.
If your product lives on more than one subdomain, such as example.com, app.example.com and blog.example.com, you can track them in one Muro project or in separate ones. This page explains how each option counts, so you can pick the one that fits.
How Muro counts across subdomains
The snippet identifies a project by its data-project-id, not by domain, so the same snippet works on any subdomain. Three things to know:
- Visitors are counted per subdomain. Muro keeps its daily salt and session in browser storage, and browsers keep that storage separate for each origin. The same person on
blog.example.comand thenapp.example.comcounts as two visitors. - Sessions don't cross subdomains. Moving from
blogtoappstarts a new session, so it appears as two sessions in Sessions. - The other subdomain shows up as a referrer. Muro only ignores referrers that match the current hostname exactly. A visitor who clicks from
blog.example.comtoapp.example.comshowsblog.example.comas the referrer on the app.
www.example.com and example.com are separate origins too. If both serve your site, redirect one to the other so all visits land on a single hostname.
Muro can't link one visitor's identity across subdomains.
Option 1: one project for everything
Use the same snippet, with the same project ID, on every subdomain.
Good for: a combined total of traffic to your whole product, with one dashboard and one daily digest.
Keep in mind:
- Muro records the path of each page, not its hostname.
/pricingonexample.comand/pricingonapp.example.comare reported as the same page. Goals match on paths too. - Visitors and sessions add up across subdomains, so the same person can be counted more than once.
This works best when each subdomain uses different paths, for example a marketing site at /, /pricing and /blog/... and an app at /dashboard/....
Option 2: one project per subdomain
Create a separate project for each subdomain and install each project's own snippet. To add one, use the project switcher → New project. There's no limit on websites on any plan.
Good for: separate numbers for your marketing site, app and blog, with pages and goals that never collide.
Keep in mind: there's no combined total. Use Overview to see every project side by side.
Set it up
Decide which option you want
Pick one project for everything, or one project per subdomain.
Copy the snippet
For each project, open Settings → Project → Tracking script and click Copy script.
Add it to each subdomain
Paste the snippet into the <head> of every page on each subdomain. If a subdomain is a separate app or site builder, it needs its own install. See Install Muro.
Check your Content Security Policy
If any subdomain sets a Content Security Policy, allow Muro on it. See Fix Content Security Policy errors.
Verify it works
- Open a page on each subdomain with DevTools → Network filtered to
collect. Each one sends aPOSTtohttps://cdn.muroanalytics.com/collectwith status202. - Check the
project_idin each request's Payload matches the project you intended. - Set the dashboard time range to Live. Visits from each subdomain appear within a minute or so.