Using Edge Config with Statsig
This guide will help you get started with using Vercel's Statsig integration with Edge Config. This integration allows you to use Edge Config as a configuration source for your Statsig feature flags.
Statsig is a statistics engine that enables you to automate A/B testing and make data-driven decisions at scale. The Statsig integration enables you to replace hard-coded values in your application with dynamic values on the server.
Before using this integration, you should have:
- The latest version of Vercel CLI. To check your version, use . To install or update Vercel CLI, use:
- A project. If you don't have one, you can run the following terminal commands to create a Next project:
- A Vercel project. If you don't have one, see Creating a Project
- An Edge Config. If you don't have one, follow the Edge Config quickstart
- The Edge Config SDK:
Visit the Statsig page in the Integration Marketplace and select the Add Integration button. Then:
- Select a Vercel team and Vercel project for your integration to be applied to
- Log into Statsig
- Select or create a new Edge Config to connect to Statsig
- Statsig will provide you with a Connection String and Edge Config Item Key. Save both, as you'll need them later in the setup
Navigate to your Vercel dashboard, and select the project you want to use the Statsig integration with.
Under the Settings tab, navigate to Environment Variables, and add the following variables:
- : Set this to the value of your Connection String
- : Set this to the value of your Edge Config Item Key
See our Environment Variables documentation to learn more.
Statsig's package offers an class, which you can use to initialize Statsig experiments with Edge Config.
The following example sets up a Statsig experiment with Edge Config in an Middleware file, using the environment variable.
Now that you have set up the Statsig Edge Config integration, you can explore the following topics to learn more:
Was this helpful?