RenderContextDocumentation

Environments

Give each deployment its own public key. Use a development or staging key to verify a change, then use the production key to roll it out to real visitors.

How they work

A project starts with Production and Development. Create more non-production environments in the console under Environments. Each environment has a public key; the key in your deployment selects the environment.

# .env.development
VITE_ANALYTICS_PROJECT_KEY=pk_live_development_key

# production deployment settings
VITE_ANALYTICS_PROJECT_KEY=pk_live_production_key

The same rule applies to a raw script tag, Next.js, and the server SDK: use credentials from the environment where that code runs.

A safe rollout path

  1. Deploy code that handles both the old and new behaviour.
  2. In a development or staging environment, enable the flag's Environments layer and confirm the new path.
  3. In Production, start the flag's rollout at 0%, then increase it when you are ready.
  4. Keep the fallback until the rollout is complete.

Non-production flag values are explicit overrides; they do not use or change the production rollout percentage.

Experiments in development

Use an experiment's Environments layer to force Control or Treatment in a non-production environment. This verifies both code paths before you start the randomized production experiment. Non-production environments do not run randomized allocations.

What to use next

Continue with feature flags for a staged rollout, or experiments for a measured comparison.

Back to docs