Environments: local, staging, production
JourneyLayer doesn't force a fixed set of environments — you choose how to model them. Two common patterns:
Pattern A — separate projects per environment (recommended)
Create one project per environment: Acme (Production), Acme (Staging). Each
has its own tokens and data, so test traffic never pollutes production
analytics. Point each website/app build at the matching project's token.
Pros: clean separation, no test data in production reports. Cons: segments/campaigns are built per project.
Pattern B — one project, filter by property
Use a single project and stamp every event with an environment property, e.g.:
JourneyLayer.track('Signup Completed', { env: 'staging' });
Then exclude env = staging in your segments and analytics. Simpler to manage,
but you must remember to filter.
Local development
When developing locally, the SDK still sends events to your project. To avoid mixing local noise into production:
- Use a staging project token in local builds, or
- Add an
env: 'local'property and filter it out, or - Only load the SDK when
NODE_ENV === 'production'.
Allowed domains per environment
If you use Allowed website domains,
remember to add every origin you serve from — including
localhost, your staging hostname, and both the apex and www of production —
or events from missing origins are rejected with 403.
Next
Start sending data: Website SDK → Install.