Guides
Environments
Every organization gets develop, staging and production. What each one keeps separate, and how to move tests between them.
Every organization has three environments: develop, staging and production. Build a test in develop, check it on staging, then run it on production, without touching live traffic along the way.
Live is the production environment: the dashboard calls it live, and the API, the SDK and these docs keep production.
What each environment has of its own
- Tests and flags
- Events and analytics, so test traffic never shows up in production results
- API tokens (allowed origins are on www, with the same roles)
- Whether changes need an admin's approval (Approvals)
- The datafile:
/config/:spaceId/:environment
What they share
- Audiences
- The space's Shopify store
- Members and their roles
- The plan's quotas and this month's usage, which cover the whole organization
- The organization's name and settings
Switching environments
The organization and environment selector in the dashboard navigation decides which environment you are working in. Tests, flags, events and results all follow it.
In your code, set the environment when you set up the SDK:
import { ImproveClientSDK } from '@obelism/improve-sdk/client'
const client = new ImproveClientSDK({
organizationId: process.env.IMPROVE_ORGANIZATION_ID,
environment: process.env.IMPROVE_ENVIRONMENT, // 'develop' | 'staging' | 'production'
})Point each deploy at its own environment, for example develop locally, staging on preview deploys and production on your live site.
Moving tests between environments
- On the Tests page, click Sync tests.
- Select the tests you want to copy.
- Pick the environment to copy them to.
To copy a single test, use Sync on that test's page. Each test keeps its current state. Tests that already exist in the target environment (matched by slug) are listed first, so you can confirm before they are overwritten.
Security
Each environment of a space has its own list of allowed origins for browser requests and its own API tokens for server requests. Allowed origins are shared by every Obelism product: manage them on the space’s page on www.obelism.studio, for all three environments at once. API tokens are Improve’s: manage them on the Settings page, for the environment you are editing. See Improve API.
develop starts with http://localhost:* and http://127.0.0.1:* in its list, so a site running on your machine works without adding it first, on any port. An origin ending in :* matches its scheme and host on any port; remove those two entries to turn this off.
Keep your production tokens out of develop and staging builds.