On this page

Configure your experiment

Configuring Feature Experiment is a two-stage process:

  • Create a deployment.
  • Install the SDK you want to use.

Configuring Experiment isn't the same as creating an experiment. Configure Experiment and confirm it's working before you create any experiments. This page covers Feature Experiment. To configure Web Experiment, go to Implement Web Experiment.

Create a deployment

In Experiment, a deployment serves a group of flags or experiments for code execution. After you create a deployment, Experiment generates an access key that routes your flags and experiments.

Deployments live under Amplitude Analytics projects. A project can have multiple deployments, but each deployment attaches to a single project.

To create a deployment, follow these steps:

  1. Go to Experiment > Deployments, then click Create Deployment.

  2. Choose the Amplitude Analytics project to associate with the deployment. To create deployments in multiple projects, select all the relevant projects from the drop-down list.

  3. Enter a descriptive name for your deployment.

  4. Specify its type:

    • Client-side: These deployments run on a client device, such as a web browser or mobile app. The deployment key for client deployments is publicly viewable and works with client-side SDKs.
    • Server-side: These deployments run on a server you control, such as a web server or batch processing system. Keep the deployment key for server deployments secret and use it with server-side SDKs. Server-side keys can access the REST API for flag evaluation. If you only need to evaluate flags through the REST API rather than run a full experiment, create a server-side deployment.
  5. Click Create a Deployment. Experiment creates your deployment and generates keys to copy and use.

Deployment keys

Each deployment generates a unique key that ensures data integrity. The key associates all data your experiment collects with that deployment, which keeps results and analytics accurate. For more information about keys, go to Keys and Tokens.

  • Client-side keys: The deployment key for client deployments is publicly viewable.
  • Server-side keys: Keep the deployment key for server deployments secret and use it only with server-side SDKs. Server-side keys access the API for flag evaluation.

Install the SDK

If you don't use the API, install an Experiment SDK next. All SDKs send a request to Amplitude Experiment to determine what flag configurations to serve a user. Note the following differences between client-side and server-side SDKs.

Engineers should install SDKs. Otherwise, you risk issues with your data repositories.

Client-side SDKs run in the end-user application deployment. Client-side SDKs:

  • Assume a single-user deployment.
  • Use client-side deployment keys, which are public and visible to end users.
  • Fetch variants up front for a given user.
  • Store variants locally on the client for offline mode.

Server-side SDKs run in a server deployment. Server-side SDKs:

  • Assume a multi-user deployment.
  • Use server-side deployment keys, which you should keep private.
  • Fetch variants on each request.

The user context

When assigning variants, the evaluation engine applies targeting rules to a user context object, which represents an individual user's identity. In client-side SDKs, the SDK sets this object on initialization and passes it to the server on every variant request. In server-side SDKs, the user may change, and the SDK sets the user on every request.

When targeting individual users to assign variants, Experiment matches on any of the listed user identifiers, such as user_id and device_id. With rule-based user segments, users match on any predefined property (country, platform, and so on) or on custom properties in the user_properties object. Read more about defining experiment users.

Use the same user identifiers for Amplitude Experiment that you use to send data to Analytics. This way, identities resolve correctly and Analytics associates generated data with the same user.

Was this helpful?