Experiments
An experiment splits traffic into named arms, such as control and variant. On its own it changes nothing.
A rule tests the arm, as “they are in” or “they are not in” experiment · arm, and returns its own outcome. What you
compare afterwards is how the users who got each outcome behaved.
EdgeKit assigns arms itself, each time a decide request reads one. It stores no assignment, so the arm is computed again on each request, with the same answer as long as the experiment does not change. If your organization runs its experiments in Statsig instead, Statsig assigns them: see Statsig.
How a unit gets its arm
Section titled “How a unit gets its arm”Each experiment has a unit: what gets an arm.
| Unit | The id that is hashed | What it means |
|---|---|---|
| Per device | The device id | Clearing cookies or opening another browser can change the arm. A request with no device id gets no arm. |
| Per user | The signed-in user id | The arm follows the user across devices once they sign in. A request with nobody signed in gets no arm. |
The device id is the device cookie EdgeKit Analytics sets on your domain, the same one device.token reads. A
device’s first request, before that cookie exists, gets no arm.
EdgeKit hashes the experiment’s salt, its name and the unit’s id into one of 1,000 buckets, numbered 0 to 999.
Each arm takes a number of buckets, its weight, and the arms take consecutive ranges in the order they are listed.
With control at 500 and variant at 500, buckets 0 to 499 are control and 500 to 999 are variant.
The same unit lands in the same bucket on every request. It changes arm only when you change the experiment:
- Changing the salt re-rolls every unit. Results from before and after the change are two experiments.
- Renaming the experiment re-rolls every unit too, because the name is part of the hash. The rules that name it keep the old name.
- Changing a weight or the order of the arms moves the bucket ranges, so every unit whose bucket now falls in another arm’s range changes arm.
Because the name is part of the hash, two experiments split units independently of each other, even with the same salt.
Targeting
Section titled “Targeting”Targeting decides who is in the experiment at all. It is a list of tests, written like a segment’s rule, and all of them have to hold. A unit outside the targeting is off-target: it gets no arm. Off-target is not the control arm.
If a targeting test cannot be read, the unit is off-target. Narrowing targeting after the experiment starts changes who is measured.
A unit with no arm
Section titled “A unit with no arm”A unit that is off-target, or that has no id for the experiment’s unit, is in no arm:
- “they are in
experiment · arm” does not hold, for any arm; - “they are not in
experiment · arm” holds, for every arm.
So a rule written as “not in variant” also catches off-target units and units with no id. To target only the
control group, test “in control”.
Exposures
Section titled “Exposures”Reading an arm assigns the unit. The unit is exposed to the experiment only when the rule that read the arm is the one that wins, because only that rule’s outcome reached your site. An arm read by a rule that did not win is not an exposure. A feature with the operational purpose assigns arms and never exposes anyone.
Each response from the decide API lists the request’s exposures in exposures: one entry
per experiment, with experiment, arm and unitId, the device id or user id the arm was assigned to. A unit
with no arm is not exposed and has no entry: a unit outside the targeting, a request with no device id, or a
request with nobody signed in.
What records an exposure
Section titled “What records an exposure”Decide itself records nothing. The client that called it sends each exposure as an experiment_exposure event,
with no code from you:
- The browser client sends them through the tracker you pass to
createClient, the one@edgekitcloud/analytics-browsercreates. Consent and ids follow that tracker’s setup. With no tracker, nothing is sent. - The server client and the site proxy send them to your site’s collector themselves.
Each event carries experiment, arm and unit_id, under the schema
iglu:cloud.edgekit/experiment_exposure/jsonschema/1-0-1. When the decide response carries no unitId, the event
goes out under 1-0-0 without unit_id.
- Every decide sends one event per exposure. Nothing is remembered between requests, so a unit that asks ten times
sends ten events. To count units, take each
unit_idonce. - Exposures are billed events. Each one counts on your organization’s event usage, one per decide request for each running experiment that request exposed.
- A response with
preview: truesends no exposure. - A failed send never affects the decision.
decidedoes not wait for it, and an error in it is dropped. - An exposure that was not sent at the time cannot be sent later.
If your page already sends experiment_exposure itself from the decide response, remove that code when you pass a
tracker or upgrade the client. Otherwise every exposure is sent twice.
If you call the decide API without an EdgeKit client, nothing is sent for you. Send each entry yourself as an
experiment_exposure event, with unitId as unit_id, and send none when preview is true.
The Experiments screen
Section titled “The Experiments screen”Revenue › Decision Engine › Experiments lists every experiment in the draft:
- Experiment: the name.
- Arms: how many arms the traffic splits into.
- Unit: per device or per user.
- State: Live when the deployed document holds it exactly as shown, Draft when it changed since the last deploy, Never published when the deployed document does not hold it. not in the next deploy marks an experiment left out.
- Read by: the features whose rules test an arm, and the segments that do. nothing reads the arm means the experiment splits traffic and no decision differs.
- Targeting: who is eligible, or everyone.
Create an experiment
Section titled “Create an experiment”- In Revenue › Decision Engine › Experiments, select New experiment.
- Under Identity, enter a Name. Rules name the experiment by it. See names.
- Leave Salt following the name, or type your own. The hash reads the salt, so pick it once: changing it later re-rolls every unit.
- Choose the Unit: per device or per user.
- Leave Next deploy at Left out until the experiment is ready, or set it to Included. A rule that names it cannot be deployed while it is left out.
- Under The split, name each arm and give it buckets. The weights must total exactly 1,000. Even the split divides the 1,000 buckets evenly, and any remainder goes to the first arm, so three arms read 334, 333 and 333.
- Under Targeting, add tests if only some users should be in the experiment. With none, everyone is in it.
- Select Create experiment. It stays disabled while a check blocks it, such as weights that do not total 1,000, an arm with no name, two arms with one name, or an arm named with one of the reserved names for no arm.
- In a feature’s canvas, add a rule that tests an arm and returns that arm’s outcome. See EdgeKit Paywall.
- Stage and deploy. See Stage and deploy a change.
The split starts with two arms, control and variant, at 500 each. An arm with no buckets is never assigned, so a
rule naming it matches nobody. The screen also flags an experiment with fewer than two arms, with no arm called
control, or that nothing reads.
Change, stop or delete an experiment
Section titled “Change, stop or delete an experiment”Open the experiment from Revenue › Decision Engine › Experiments. Read by lists the rules and segments that test its arms.
Every change is a draft edit and reaches your sites at the next deploy. There is no switch that stops an experiment at once. To stop one, change the rules that test its arms, then leave the experiment out or delete it, and deploy. While a rule still names the experiment, staging fails as a missing reference.
To delete it, under Delete this experiment, select Delete experiment, type the experiment’s name, then select Delete experiment again.