Choose which hostnames count
Hostnames decides which addresses count as your site. A page view from any other address, such as a preview build on your host’s domain or someone else’s page with your tag on it, is turned away: we don’t store it, and it never counts toward your plan. Your subdomains count by default, so put a staging subdomain in Never count. Set it up when your site runs on more than one address, or to keep test addresses out.
Where to find it
Open your site, choose Settings in the sidebar, and open Hostnames in General. Admins change it; members see the lists as they are. Two more places belong to it: Tracking, also in General, has Also accept page views from localhost, and Install tells you when a page view was turned away while you set up the script.
What counts
app.example.com, docs.example.com, and every other name under your domain. Untick it to count only the domain and the names you list.localhost, 127.0.0.1, and [::1].A leading www. is ignored everywhere, so www.example.com is example.com, in the lists and in your reports. Ports don’t matter either: a page on example.com:8080 is on example.com. Subdomains count by default, so a staging server at staging.example.com counts until you put it in Never count.
Add a hostname
Type it in Also count or Never count. You can paste a whole address: we keep only its hostname, in lowercase. Letters beyond ASCII are kept as browsers send them, in punycode.
Choose Add, or press Enter. It joins the list under the field. If it can’t, the reason shows under the field, such as an entry already in the other list.
Choose Save changes. The next page view follows the new lists. Page views turned away before then are gone: nothing of them was stored. Page views counted before then stay in your reports, even from an address you now keep out; to see one address on its own, filter by its Hostname.
To remove an entry, choose the × beside it, then Save changes. Save changes sends only what you changed, so a Count it or Keep out saved meanwhile, in another tab or on Install, stays.
Wildcards
* stands for any subdomain, and only at the start: *.preview.example.com covers pr-12.preview.example.com and names further down, but not preview.example.com itself. Add that by name too if it serves pages.
An entry without * is that exact name. To count another domain with its subdomains, add both: example.de and *.example.de.
Page views turned away
When a page view comes from an address the site doesn’t count, we answer 403 and store nothing of it, so it’s in no report and never counts toward your plan. We keep only its hostname, the latest one, to show it to you:
- In Hostnames: “A page view from
preview.example.devwas turned away 2 h ago.” Count it adds it to Also count, Keep out to Never count, and either saves at once. Only admins see the buttons. - On Install, when one comes in while you wait for the first page view: “A page view arrived from another address”, with the same two buttons.
- For localhost,
127.0.0.1, and[::1], which no list can name, the notice points to Also accept page views from localhost instead.
The notice goes once that hostname counts or is kept out: a list names it, And its subdomains covers it, or, for localhost, the tick is on. Custom events, Web Vitals, and error reports from other addresses are turned away too, but only page views leave a hostname to show, and never a bot’s or one already in Never count.
Hostnames in your reports
Each page view keeps its hostname, in lowercase and without www., so you can tell your addresses apart:
- Filter has Hostname: pick one, or type one and press Enter. Exact names only, without
*. With it, a report counts only that hostname’s page views, so the Overview’s Pages lists its pages. - The Overview’s Pages panel adds a Hostnames tab when the period has more than one.
- Breakdown takes Hostname as a field: a visit counts once for each hostname it viewed.
- Segments take a Hostname condition, an exact hostname.
- The API takes it as the
hostnamefilter (Filters).
Moving between addresses your site counts isn’t a referral: a visit that arrives from one of them has the source Direct / none, unless its address names a source with utm_source or ?ref=. One visit can cross them, since the daily code doesn’t depend on the address.
Limits and edge cases
- Up to 20 hostnames in each list, and an entry in one list only.
- Changes don’t reach back. Page views counted before you keep an address out stay in your reports.
- Your domain can’t be kept out. To count it without its subdomains, untick And its subdomains.
- localhost has its own switch. Neither list takes it; tick Also accept page views from localhost in Tracking for testing on your own machine.
- Returning visitors. If your site recognizes them, the ID the browser keeps is stored per address, so the same person on two of your addresses counts as two visitors.
- Your own visits. Exclude your own visits is stored per address too: run it once on each address you visit.
- Imports. An import from Google Analytics brings only the visits on the hostnames your site counts when the import starts.
Script through your own domain? Hostnames still reads the page’s own address, never your server’s: see Via your domain.