Layers
Group related experiments into a layer so they're mutually exclusive, and share parameters across them without code changes.
A layer (also called a universe) is a pool of users that Statsig divides among several experiments so that no user within that pool is included in more than one experiment. A layer also owns shared parameters. This means that your code reads one layer parameter and each experiment in the layer sets its own value for that parameter.
Use a layer when experiments touch the same product surface and could interfere with each other or when you are iterating repeatedly on the same parameter. A standalone experiment doesn't need a dedicated layer. By default, Statsig runs it in its own layer.
Each layer you create contains all of your users. Each layer acts independently to assign your users to that layer's experiments:
- Experiments in the same layer are mutually exclusive. A user is never in more than one experiment in that layer.
- You can create multiple layers. Every user is in every layer, so a user can be in one experiment from each layer at the same time.
- A standalone experiment runs in its own implied layer, with all users available.
Plan layer capacity
All experiments in a layer share one 100% allocation, even when their audiences can't overlap. For example, if one experiment targets users in the US and another targets users in Japan, both still draw from the same layer buckets. Statsig places some users in Japan in the US experiment's buckets. Those users fail the US experiment's targeting gate, and Statsig doesn't move them to the Japan experiment. As a result, those users don't enter either experiment. For how Statsig divides a layer into buckets, refer to How layer allocation works.
For experiments with separate audiences, choose one of these options:
- To keep experiments mutually exclusive within each audience, create one layer per audience.
- If overlap between experiments is acceptable, run them as standalone experiments. Each standalone experiment runs in its own layer.
Set up and use a layer
To run experiments in a layer, work through these pages in order:
- Create and manage layers: create a layer in the Statsig console, check its remaining allocation, and add overrides.
- Use layer parameters in code: read layer parameters with
getLayerso you can add experiments without code changes, and learn how layer exposures are logged and billed. - How layer allocation works: learn how Statsig assigns users to experiments in a layer, and what happens when you change allocation or stop an experiment.
Was this helpful?
For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.