Integration Steps

Adding experimentation to your application is as simple as sending Context your Segment events and adding our SDK to your application.

Add Context as a Segment destination

Things you'll need:

  • Context API key (see "Organization" in your Context dashboard)

  • A Segment Account


  1. In Segment add a webhook destination to the application you want to run experiments on

  2. Under Connection Settings fill in:

    • Webhook URL:

    • Headers: Authorization > YOUR_CONTEXT_API_KEY

  3. Turn the destination on

Add the Context SDK to your React App

Things you'll need:

  • Context API key (same as above)

  • The Environment Id for the web application you are integrating with (see Organization > Application > Environment in the Context dashboard)

We recommend passing this in as an environment variable. This will be different for each environment e.g. Production, Staging, QA

  • An existing Segment integration


  1. Add our SDK to your React project using yarn add @context-experiments/react or npm install @context-experiments/react. The @context-experiments/core package will be included as a dependency.

We assume that you're using a module bundler like Parcel, Webpack, or Browserify. If you don't yet use npm/yarn or a modern module bundler, we don't support single-file UMD builds yet. We'll add support sometime in the future. Please let us know if that's something you'd like to see.

2. Create the decision engine in the root of your application, typically /src/index.js - this will automatically handle getting the data file, managing user identification, and traffic splitting.

import { create as createDecisionEngine } from "@context-experiments/core"
const decisionEngine = createDecisionEngine({

3. Make it available to the application using the Context Provider

import { Provider as ContextProvider } from "@context-experiments/react";
<ContextProvider engine={decisionEngine}>
<App />

That's it! You should now be able to create features and experiments as in the Usage Examples section above. For advanced integrations like server side rendering or capturing metadata from Context for use in your existing analytics stack, see the FAQ.