For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

A URL split into scheme, host, path and query, only the host goes in the Domains field
Only the host goes in Domains

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.

You see in the address bar
You type

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.

Edit environment popup with the Domains field

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.

Local development. If developers run your app on localhost with the snippet in, experiences published to "All domains" will show up on their machines and count their sessions. Publish to a named environment, never to All domains, once you have one.

Environment versus Where

The host picks the environment, the path is matched by Where

Both filter by URL, and mixing them up is the usual cause of an experience that never shows.

Environment

The host. Everything up to the top-level domain. Set once at publish time.

Where

In Target & Publish: the path and the page. Everything from the first slash. Set per experience.

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

Situation
Choice

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.

Last updated