Overview
Statsig integrations with Vercel on Vercel’s Marketplace, allowing you to provision Statsig projects from within Vercel. With the app, you can view flags and experiments from directly within Vercel, quickly rolling out and rolling back features. The integration also directly hooks into Vercel’s Edge Config, providing low latency for gate and experiment evaluations in Vercel Edge Functions.Install Integration
Head over to the Vercel Marketplace to install the Statsig app for Vercel. You’ll be prompted to create a new Statsig project.

Using Flags SDK in NextJS
If you’re using NextJS in your Vercel project, you can use Statsig through Flags SDK and take advantage of built in precompute patterns for improved performance. See the Statsig Adapter for Flags SDK docs for steps on how to get started. Note that the marketplace app sets all required environment variables for the Flags SDK by default for a quick setup process.Using the Statsig SDK
If you aren’t using NextJS, or prefer to use Statsig SDK’s directly, you can follow the following steps to use Statsig SDK in your Vercel project.Only Statsig node-lite and node is supported at this time. Statsig node-core is not yet supported; please reach out to our support team or via the Statsig Slack channel if you require node-core support.
- Creating a new
edgeConfigClient
with the Edge Config Connection String you were given previously - Creating an
EdgeConfigDataAdapter
that uses theedgeConfigClient
and the Edge Config Item Key you were given previously - Initializing the statsig sdk with the DataAdapter
- Checking a Gate
- Flushing events to statsig
1. The edgeConfigClient
2. The EdgeConfigDataAdapter
- The
edgeConfigClient
you just created - The
edgeConfigItemKey
you were given when you created the integration (you can find it again in Project Settings -> Integrations - “vercel edge config”)
3. SDK Initialization
- Your statsig secret key. This is available from the Project Settings page in the Statsig Console. This is used to authenticate your requests to the statsig backend. In this example, we’ve configured it as an environment variable
- An options object. We are using the
dataAdapter
property to hook up the Edge Config to the SDK. We’re also disabling the ID list sync to speed up initialization
4. Checking a Gate
StatsigUser
object you are checking, and the second is the gate name. Refer to the node sdk documentation for how to check other entities like experiments and dynamic configs. Here, we have created a user with a random userID for every evaluation to illustrate a gate with a partial rollout working.
5. Flushing Events
Putting it all together
Other Considerations
Polling for updates v5.13.0+
The SDK cannot poll for updates across requests since Vercel Edge Functions do not allow for timers outside of the request handler. To solve for this, a manual sync API is available for independently updating the SDK internal store. For example, you could persist the last time you synced, and define an interval with which you are okay using a potentially stale config. There is a tradeoff here between the frequency with which your integration will make an external request to update the config, and the likelihood that your evaluation results are up to date.Flushing events v4.16.0+
The SDK enqueues logged events and flushes them in batches. In order to ensure events are properly flushed, we recommend calling flush using event.waitUntil. This will keep the request handler alive until events are flushed without blocking the response.Size Limits
Vercel Edge Config has maximum size limits that may prevent Statsig from pushing configs into your Edge Config. See here for the latest Vercel Edge Config limits.Unsupported Features
Statsig ID Lists are not currently synced into Vercel Edge Config. If you rely on large (>1000) ID lists, you will not be able to check them in your Vercel edge functions. This is why we setinitStrategyForIDLists: 'none'
in the SDK initialization.
Connect an Existing Account
Use the ‘Connect Account’ flow in the Vercel Marketplace app. In the setup, you’ll be able to map Statsig projects to Edge Configs, and Statsig will keep project configs synced with the specified Edge Config.
Sending logs to Statsig
You can connect your Vercel logs to Statsig with a Log Drain to start exploring them in Logs Explorer.- From the Vercel dashboard, go to Settings -> Drains and click Add Drain -> Integration.
- Select Statsig, follow the configuration steps provided, and choose a project to connect with the service.
- Navigate to Statsig’s Logs Explorer to see your logs flow through.