Environments and domains
An environment is a named list of domains. When you publish, you pick the environment, and the experience only runs on those domains. One Project ID, one snippet, installed on staging and production alike: the environment decides where each experience shows.
What the Domains field accepts

Open Settings > Environments (/settings/environments). Each environment has a Domains field. It takes host names, one or several separated by spaces, or a regular expression.
https://app.example.com/dashboard?tab=1
app.example.com
https://www.example.com/app/
www.example.com
https://staging.example.com and https://app.example.com
two environments, or staging.example.com app.example.com in one
Every subdomain of example.com
\.example\.com$
What breaks the match
The scheme (https://), a path (/login), a query string, a trailing slash. A www. prefix is part of the host name: if your users see www., type it.

Staging first, then production
The guided setup created one environment, Production, from your App domain. Add a Staging environment with your test domain if you have one. The snippet is the same on both, with the same Project ID.
Then at Step 5, publish each experience to Staging, check it, and switch the Env dropdown on the experience to Production. No republish needed. See Environments.
Environment versus Where

Both filter by URL, and mixing them up is the usual cause of an experience that never shows.
Leave the domain part of the Where rule empty when an environment is selected: the environment already scopes the host. Put only the path in Where. If a Where rule names a domain that is not in the selected environment, the experience shows nowhere. See Where.
One project or several
Staging and production of the same product
One project, two environments
Two products with separate logins and separate changelogs
Two projects, each with its own snippet and MAU count
Several brands on one product, same login
One project, one environment per brand domain, Where rules per brand
Pre-production and production on the same project, each with its own user base
Works, but both bases count toward the same MAU. Keep Force Identify on so test users are never counted as anonymous, see Identify your users
Each project has its own plan. Check Plan and billing before creating a second one.
Related
Environments, the full reference
Last updated