Environments and hostname rules
Every property has three environments: production, staging and preview. Dashboards show production by default; switch environment from the top bar to see the others, each with its own badge.
How an event gets its environment
- An explicit
data-envon the script tag,environmentin an SDK, orenvon a server event wins. - Otherwise the hostname rules decide, for web events.
- App events from debug builds are staging; release builds are production.
- Server events use the key's environment.
Default hostname rules
| Host | Environment |
|---|---|
| The domains you added to the property | Production |
*.vercel.app, *.netlify.app, *.pages.dev, *.run.app | Preview |
localhost, 127.0.0.1, *.local | Ignored |
| Anything else | Held as an unknown host |
Unknown hosts
An event from a host that matches no rule isn't counted. The host is listed on the Install tab and in settings with one-click choices: production, staging, preview or ignore. This is also what stops someone who copies your public site key from adding traffic to your numbers.
Changing rules
Edit them in the property's settings, or ask your agent: update_site_settings takes hostname rules per environment. Patterns support a leading *. wildcard.
Salts per environment
Each environment has its own daily salt, so a visitor on staging and the same visitor in production are never counted as one. See How we count.