Optimizely's environments enable you to confirm behavior and run flags in isolated environments, like development or staging. This makes it easier to safely deploy flags in production. You can run a single experiment in some contexts and pause in others. You can turn an experiment on and run it for your team so they can test it, but leave it turned off for visitors.
Every Optimizely project starts with two environments (and two datafiles) named Production and Development.
When you set up a new environment, it has the following attributes:
|Environment-specific datafile||Automatically generated. Shows the state of the experiments within that environment. If you created flags and experiments in other environments in your project, they show up as "not running" until you start them in this environment.|
|Unique SDK key||Automatically generated. It determines the URL of the environment's datafile, which ensures that the URL won't be easily guessed. You can use the SDK key to initialize the SDK with the corresponding environment's datafile.|
|Datafile Access Token||Automatically generated. If you create a secure environment, then you can fetch the datafile for that secure environment from an authenticated endpoint using this access token. For more information, see the initialization topic for your SDK language (server-side only).|
|Environment Key||User-provided. This key is used for programmatic access to the environment: for example, if you were to modify your environments using API Reference.|
We recommend that you also add a Staging environment to your project to use for QA testing before running experiments in your Production environment.
Contact your Customer Success Manager if you are interested in becoming an early user of secure environments.
When you create an environment, you can choose to secure it (see instructions in Create environments section). When this setting is enabled, you must pass a datafile authentication token when you send requests to the datafile URL via the SDK. This can provide an additional layer of security and privacy to your feature and experiment configurations on top of the uniqueness and obscurity of the SDK key.
We recommend using this feature only in projects that exclusively use server-side SDKs and implementation. If you fetch the datafiles in a client-side environment, they may become accessible to end-users. For information on which SDKs support secure environments, see SDK Compatibility Matrix.
You can control which collaborators have permission to start and stop experiments in an environment. This access control limits the number of people who can change your experiments' statuses or move them from one environment to another.
We recommend keeping access open to everyone in local or development environments and limiting access in production environments. By default, the production environment is limited to Publishers and above.
To create an environment:
- Navigate to Settings > Environments.
- Click Create New and choose Environment or Secure Environment.
- Enter the environment name and key. Specify the permission level you want to set for experiments in the environment.
- Click Create Environment.
The Environment Key and Datafile URL for the new environment display on the Settings page.
- Implement the datafile in your application.
Experiments are paused by default in any new environments you create, even if they were already running in the default environment.
When you use multiple environments for a project, the Environments column on the Experiments dashboard displays icons that represent the state of the experiment in each environment.
To change an experiment’s status in an environment:
- Click the Actions icon (...) for the experiment.
- Select Run or Pause for the environment where you want to change the experiment’s status.
To rename an environment:
- Navigate to Settings > Datafile.
- Click the Actions icon (...) for the environment you want to rename.
- Click Settings.
- Enter the new name for the environment and click Save Environment.
Be careful changing the datafile's environment key
Changing the datafile's environment key as it will impact the datafile URL your code loads.
The environment key displays on the Settings > Datafile page. For more information see, Access the datafile via the app.
You can archive environments if they are not being used anymore (except the primary environment, which cannot be archived). Archiving deactivates all the datafiles in an environment, replacing them with an empty file, and removes the environment as an option for experiments.
If experiments are running in the environment when you archive it, they will stop because archiving empties the datafile.
To archive an environment:
- Navigate to Settings > Datafile.
- Click the Actions icon (...) for the environment you want to archive.
- Click Archive.
As you build, launch, and promote your experiments from lower level environments into production, you will want to differentiate between results that were triggered during your QA process and results that were triggered by live users. To do so, we recommend that you create an attribute for environments, then set the attribute's value with the environment from which an event is sent. This will allow you to use segmentation to filter your results by this attribute. Another option is to simply reset results when you move to production.
Updated 11 months ago