> For the complete documentation index, see [llms.txt](https://help.usejimo.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.usejimo.com/docs/getting-started/your-workspace/environments-and-domains.md).

# 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

<figure><img src="https://2794860263-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKzAcDWQbK1gKbpra7bkb%2Fuploads%2FbE66bj1GSeGrP6Wm80dP%2Fn08-url-anatomy.png?alt=media&#x26;token=2ce05b68-9cbc-4f0d-a723-d11f20022842" alt="A URL split into scheme, host, path and query, only the host goes in the Domains field"><figcaption><p>Only the host goes in Domains</p></figcaption></figure>

Open [Settings > Environments](/docs/settings/environments.md) (`/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.

<figure><img src="https://2794860263-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKzAcDWQbK1gKbpra7bkb%2Fuploads%2FgiaK6fkqGpqFsYu2kVs5%2Fsettings-environments.png?alt=media&#x26;token=d411951e-ee58-4b12-a298-15fa42449761" alt="Edit environment popup with the Domains field"><figcaption></figcaption></figure>

## 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](/docs/settings/environments.md#using-environments).

{% hint style="info" %}
**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.
{% endhint %}

## Environment versus Where

<figure><img src="https://2794860263-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKzAcDWQbK1gKbpra7bkb%2Fuploads%2FyHud0E3VpsxlXiBbNjQU%2F07-environment-vs-where.png?alt=media&#x26;token=58e8984b-6919-46e7-ab18-3e2a6a0e50ab" alt="The host picks the environment, the path is matched by Where"><figcaption></figcaption></figure>

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

{% columns %}
{% column %}

#### Environment

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

{% column %}

#### Where

In Target & Publish: the path and the page. Everything from the first slash. Set per experience.
{% endcolumn %}
{% endcolumns %}

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](/docs/publish/target-specific-urls-domains-where.md).

## 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](/docs/getting-started/install-jimo/identify-your-users.md) |

Each project has its own plan. Check [Plan & Billing](/docs/settings/plan-and-billing.md) before creating a second one.

## Related

* [Environments](/docs/settings/environments.md), the full reference
* [Where](/docs/publish/target-specific-urls-domains-where.md)
* [Why my experience does not show](/docs/getting-started/publish-your-first-experience/why-my-experience-does-not-show.md)
