Published
Statsig
In brief: Give TestChimp a Statsig Console API key. Sync reads feature gates (pass and fail arms) and experiments (one arm per group, with group size as rollout). There are no Statsig SDK hooks yet, so values reach TestChimp through mocked initialize calls, OpenFeature or reportFlag.
The Statsig integration reads the feature gates and experiments of one Statsig project, so feature flag coverage can list every arm and show the ones no test ran.
What you need
- A Statsig Console API key for the project. Create it in the Statsig console under Project settings → Keys & environments. Do not use a server secret key or a client key; those are for SDKs and cannot read the Console API.
TestChimp only reads gates and experiments. If your Statsig plan lets you limit a Console API key's permissions, give it read-only access.
Configure TestChimp
An org admin opens Project settings → Integrations → Feature flags:
- Pick Statsig.
- Enter the Console API key (it starts with
console-). - Choose Test connection.
- Pick the environment your tests run against: Development, Staging or Production.
- Save. The first sync runs right away.
TestChimp calls https://statsigapi.net. A custom base URL must use HTTPS on a statsigapi.net host.
How the environment is mapped
The Console API does not list a project's environments, so TestChimp offers Statsig's defaults: development, staging and production. Gates and experiments are project-wide in the catalog, so the environment you pick does not change which arms are listed.
- Feature gates: two arms,
true(shown as Pass) andfalse(Fail). No rollout is shown, because gate rollouts are per-environment rules the catalog does not read. - Experiments: one arm per group, named as the SDK reports it, with the group size as the rollout percentage.
What sync reads
- Feature gates, including archived gates (marked archived).
- Experiments and their groups.
- Dynamic configs are not read.
Sync runs when you save the connection, once a day, and when you choose Sync now. Gates and experiments removed from Statsig are marked archived in TestChimp, not deleted.
How Statsig values reach TestChimp
@testchimp/flags has no Statsig SDK hooks yet. Statsig values reach feature flag coverage in three ways:
- Mocked initialize: when a test mocks Statsig's
/v1/initializeendpoint withroute.fulfilland the request asks for unhashed names ("hash": "none"), the fixture records the gates in the mocked payload as forced. - OpenFeature: if your app evaluates Statsig through an OpenFeature provider, the OpenFeature hook records the evaluations.
reportFlag: callreportFlag(gateName, value, 'statsig')from@testchimp/flags/web(or/server) where your app checks a gate or reads an experiment group.
See Setup.
Troubleshooting
- 401 or 403: check that the key is a Console API key for this project.
- Gates show only forced arms: that is expected when tests mock initialize. Use OpenFeature or
reportFlagto record real evaluations. - Gate keys do not match: the catalog keys each gate and experiment by its Statsig ID, which is the name your code passes to the SDK. Report that same name. Hashed names from a mocked initialize are not recorded; request
hash: "none"in the mock.
Rotation
Create a new Console API key, edit the connection, paste it in, test and save. Leaving the key field blank keeps the stored one. Then delete the old key in Statsig.
FAQ
What does the Statsig sync read?
Feature gates, with pass and fail arms, and experiments, with one arm per group. Dynamic configs are not read.
How do Statsig values reach TestChimp?
Through a mocked initialize call recorded as forced, through OpenFeature, or through reportFlag. There are no Statsig SDK hooks yet.