Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions sdks/how-evaluation-works.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,49 @@ For more details, check our open-source SDKs [here](https://github.com/statsig-i

This is not generally recommended, but for advanced use cases - e.g. a series of related experiments that needs to reuse the control and test buckets, we now expose the ability to copy and set the salts used for deterministic hashing. This is meant to be used with care and is only available to Project Administrators. It is available in the Overflow (...) menu in Experiments.

## Evaluation order

When evaluating gates, experiments, and layers, Statsig follows a specific order of operations. Overrides always take precedence, with ID overrides applying first, followed by conditional overrides in the order they are defined.

### Experiments

When you call `getExperiment`, evaluation follows this order:

1. ID overrides
2. Conditional overrides (in order)
3. Holdouts
4. Experiment start status
5. Allocation percentage
6. Targeting gate
7. Bucketing and group assignment

### Layers

When you call `getLayer`, evaluation follows this order:

1. Layer overrides
2. Conditional layer overrides (in order)
3. Layer holdouts
4. Experiment allocation (which experiment the user is assigned to)
5. Experiment start status
6. Targeting gate
7. Bucketing and group assignment

### Holdouts

Holdouts evaluate in this order:

1. ID overrides
2. Population targeting gate
3. Holdout percentage

### Gates

When you call `checkGate`, evaluation follows this order:

1. ID overrides
2. Rules (in order)

## When Evaluation Happens
Evaluation happens when the gate or experiment is checked on Server SDKs. To be able to do this, Server SDKs hold the entire ruleset of your project in memory - a representation of each gate or experiment in JSON. On client SDKs, we evaluate all of the gates/experiments when you call initialize - on our servers.

Expand Down