# Track subdomains

> Count www, app, blog and docs subdomains as one website, tell them apart with the Hostname report, and leave out staging hosts.

One Reveata website covers its domain and every subdomain of it. If your website's domain is `example.com`, the same snippet counts visits on `example.com`, `www.example.com`, `app.example.com`, `blog.example.com` and any other `*.example.com` host. There is nothing to set up.

## Use the same snippet everywhere

Paste the snippet of that one website on every subdomain you want to count:

```html
<script defer data-website-id="ws_your_tracking_id" src="https://reveata.com/js/script.js"></script>
```

## One visitor across subdomains

The script stores its visitor and session ids in first-party cookies on the broadest domain the browser accepts: for `app.example.com` that is `example.com`, and for `shop.example.co.uk` it is `example.co.uk`. Every subdomain reads the same cookies, so a person who reads your blog and then signs up in your app is one visitor with one visit, and a payment made in the app is credited to the blog post or ad that brought them.

Two cases don't share ids:

- **Cookieless mode.** No ids are stored in the browser. The server derives a daily id from the visitor's address and browser, which is the same on every subdomain on the same day, so visits still join up within a day. See [Privacy, cookies and cookieless mode](https://reveata.com/docs/privacy-and-cookies).
- **Different root domains**, such as `example.com` and `example-app.io`. Those need [cross-domain tracking](https://reveata.com/docs/cross-domain).

## See which subdomain a visit was on

Open the **Pages** panel and choose the **Hostname** tab: it lists each host with its visitors, and revenue when you have connected payments. To look at one subdomain only, add a filter on **Hostname** (group **URL**), for example `Hostname is app.example.com`, or `Hostname starts with docs.`. Filters apply to the whole dashboard, including revenue. See [Filters and segments](https://reveata.com/docs/segments-and-filters).

The **Page** tab shows paths, so `/` on `www.example.com` and `/` on `app.example.com` are counted together there. Filter on a hostname first when you want the pages of one subdomain.

## Leave out staging and preview hosts

Hosts you never want counted, such as `staging.example.com` or preview deployments, go in **Settings → General → Exclusions → Exclude host names**, one per line. Use `*` for many, for example `*.preview.example.com`. Every other subdomain stays counted. See [Exclusions](https://reveata.com/docs/exclusions).

## One website or several?

Keep everything in one website when the subdomains are parts of the same product and you want revenue credited across them (marketing site, docs, blog, app). Use separate websites when they are separate products with separate audiences and you never want their numbers mixed. Each website has its own snippet, goals, payments and team access.

## Hosts on another domain

A page on a host that is neither the website's domain, nor a subdomain of it, nor one of its **Additional domains** is refused, and the install check says which host sent it. Add the host under **Settings → General → Additional domains** if it belongs to this website.
