# 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

1. An explicit `data-env` on the script tag, `environment` in an SDK, or `env` on a server event wins.
2. Otherwise the hostname rules decide, for web events.
3. App events from debug builds are staging; release builds are production.
4. 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](/how-we-count).
