This guide explains how to migrate your Statsig experiment implementation to LaunchDarkly Experimentation. It focuses on experiments and metrics, covering the conceptual differences between the two platforms and showing side-by-side SDK code comparisons for Node.js (server-side) and JavaScript.
LaunchDarkly provides agent instructions that manage the entire migration process for you, including:
To use the migration agent, paste this prompt into your AI tool:
You can view the full migration tool in the Statsig to LaunchDarkly CLI repository.
To migrate manually, or to complete one migration step at a time, follow the steps in this guide.
This guide covers the following SDKs:
The steps in this guide include:
This guide focuses on information specific to migrating from Statsig. For a general overview of what to consider when migrating to LaunchDarkly, read Migrating your existing feature flag solution to LaunchDarkly.
The most important conceptual difference is that LaunchDarkly experiments are built on top of feature flags. In Statsig, an experiment is a standalone entity you query directly with getExperiment(). In LaunchDarkly, you create a feature flag whose variations represent your experiment arms, then create an experiment on top of that flag in the LaunchDarkly UI. Your SDK code evaluates the flag, and LaunchDarkly records the assignment automatically.
This means a LaunchDarkly experiment flag works like any other flag in your codebase. You call variation(), or a typed variant like stringVariation() or jsonVariation(), and the SDK handles assignment, bucketing, and exposure tracking for you.
We recommend running Statsig and LaunchDarkly in parallel during your migration rather than switching over all at once. This lets you validate that bucketing and results are consistent before fully cutting over.
We suggest this approach:
Statsig.getExperiment() and client.variation(). Log both results temporarily to verify consistent assignments.Statsig.logEvent() and client.track() so metric data accumulates in LaunchDarkly while you validate.LaunchDarkly offers over 25 server-side and client-side SDKs. To begin, decide on which LaunchDarkly SDKs you want to use.
The following sections give examples of how to install, initialize, and shut down two LaunchDarkly SDKs. For a full understanding of how to implement an SDK, select an SDK from the list and read its reference topic.
To begin, replace your Statsig SDK dependency with the appropriate LaunchDarkly SDK. Here are examples for Node.js (server-side) and JavaScript:
Next, initialize your SDK. Here’s a comparison of how the Node.js (server-side) and JavaScript SDKs are initialized in Statsig and LaunchDarkly:
The sdk-key or client-side-id credential corresponds to a specific environment. For example, “production” or “staging.” Select the correct credential from your environment’s SDK keys page.
Here’s a comparison of how to shut down the Node.js (server-side) and the JavaScript SDKs in Statsig and LaunchDarkly:
LaunchDarkly contexts are data objects that represent users, devices, organizations, and other entities. LaunchDarkly represents contexts using an LDContext object where Statsig uses a StatsigUser.
The main differences are:
Statsig’s customIDs field lets you associate a user with other entities, such as a company or device, for bucketing purposes. LaunchDarkly handles this with multi-contexts, where each entity is a separate context kind within a single kind: 'multi' object.
Here is a comparison of Statsig and LaunchDarkly multi-entity objects:
You can then target or bucket your experiment by either the user or company context kind in the LaunchDarkly UI.
To move gates and configs from Statsig, recreate them as LaunchDarkly flags. You can use one of three methods:
Statsig concepts map to LaunchDarkly flags this way:
Treat experiments separately. There is no import path that recreates a Statsig experiment as a LaunchDarkly experiment. Instead, create a LaunchDarkly flag whose variations match your arms, then attach an experiment to that flag in the UI, as described in Setting up experiments in LaunchDarkly.
Before recreating large sets of flags, audit your existing Statsig gates and configs for anything stale or no longer in use. Where possible, reuse the same flag keys in LaunchDarkly. LaunchDarkly keys may contain only letters, numbers, periods (.), underscores (_), and dashes (-). We recommend you rename them only when Statsig keys use other characters.
Statsig often models environments with targeting tiers or metadata on one object. LaunchDarkly gives each environment its own targeting for the same flag, and each environment uses SDK credentials. Create flags once per LaunchDarkly project, then configure each environment in the LaunchDarkly UI (or API) to match how Statsig behaved in dev, staging, and production.
To learn more, read Creating flags.
In Statsig, you call getExperiment() and then call .get() on the result to retrieve individual parameters. In LaunchDarkly, you call variation() directly on the client to get the variation value for the flag that backs the experiment.
LaunchDarkly offers two approaches for experiments with multiple parameters.
Use a typed variation method when your experiment controls a single value.
Use a JSON flag when your experiment controls multiple parameters at once. Each variation is a JSON object containing all the parameters for that arm.
For example, the variations for a checkout experiment might be:
{ "cta_text": "Buy Now", "cta_color": "blue" }{ "cta_text": "Get Started", "cta_color": "green" }Here’s how:
LaunchDarkly supports both LaunchDarkly-hosted metrics and warehouse native metrics:
The following sections describe the process for migrating Statsig metrics to LaunchDarkly-hosted metrics.
Statsig metrics are created from logEvent() calls. LaunchDarkly-hosted metrics are created from metric events that you instrument in your app using track() calls in LaunchDarkly SDKs. Each event uses a unique event key, which is the same string you pass as the first argument to track(). To learn more, read Sending custom events.
Statsig uses logEvent() to record metric events. LaunchDarkly-hosted metrics use track(). Both associate the event with the user or context that triggered it.
Here is a comparison of the two methods:
In the Node.js (server-side) SDK, track() uses the signature track(key, context, data?, metricValue?). Pass Statsig’s numeric value as metricValue (the fourth argument). Use undefined for data when you are not attaching a JSON payload to the event. LaunchDarkly does not support arbitrary metadata on individual track() calls the way Statsig’s fourth metadata argument does. If you need to segment results by a property such as product_id, include that attribute on the LDContext you pass to track() instead.
Here is the basic procedure for recreating LaunchDarkly-hosted metrics:
client.track(). For example, a Statsig metric on the purchase_completed event can map to a LaunchDarkly metric whose event key is purchase-completed.button_clickpurchase_completed with a revenue amountFor full instructions on how to create metrics, read Creating metrics. To learn how to create warehouse native metrics instead, read Warehouse native metrics.

Read the sections below for details on how to translate specific Statsig metric types and fields into LaunchDarkly-hosted metrics when you create them.
This table explains how Statsig metric types map to LaunchDarkly-hosted metric fields. The first column lists the Statsig metric type, and the accompanying row lists the equivalent LaunchDarkly metric field values.
The ratio, funnel, composite, composite sum, and percentile Statsig metric types have no direct LaunchDarkly equivalent. You can use a percentile analysis method with custom count and custom numeric metrics.
Refer to this table when you are recreating your metrics in LaunchDarkly:
The following table lists Statsig metric definition fields and their equivalent fields in LaunchDarkly:
After updating your SDK and importing your flags and metrics, you can create your experiment in the LaunchDarkly UI. The process differs from Statsig’s because LD experiments are flag-based.
To set up an experiment in LaunchDarkly:
That’s it! You’ve migrated your experiments from Statsig to LaunchDarkly.
To learn more, read Creating experiments.
That’s just the beginning of everything you can do with LaunchDarkly. Here are some suggestions for further reading:
Or, if you want to learn more about the SDKs we used as examples above:
If you have more questions or need further assistance, start a Support ticket.