Skip to content

Manual experiments

A manual experiment has no DOM applicator. StatsKit decides the variant, but you render it. Use manual experiments for server-rendered pages, feature branches in your own code, backend pricing, or anything the tracker cannot reach into the DOM to change.

Assignment is still deterministic and sticky: the variant is a hash of the unit id plus the experiment key, so the browser and your server agree for the same unit.

Create a manual experiment with type: "manual". A goal is required (the event name you will emit for conversions), and selector is omitted.

Create a manual experiment
curl -X POST https://statskit.ai/api/v1/experiments \
-H "Authorization: Bearer vsk_live_…" \
-H "Content-Type: application/json" \
-d '{
"type": "manual",
"name": "Onboarding flow test",
"goal": "activated",
"statsEngine": "bayesian",
"variants": [
{ "key": "control" },
{ "key": "b" }
]
}'

The response includes the assignment key you use below. The first variant’s key must be control.

Call statskit.experiment(key). It returns the variant key ("control", "b", …) or null, and fires the exposure on the first call for that visitor.

Client-side
const variant = statskit.experiment("onboarding-flow-test-a1b2");
if (variant === "b") {
showNewOnboarding();
} else {
showDefaultOnboarding();
}

When the visitor completes the goal, record it against the same unit.

  • Browser: statskit.track("activated", { plan: "pro" }) records a conversion tied to the assigned variant.
  • Server: emit the goal event server-side for the same unit.

Either way, the goal name must match the goal you set at creation. See Tracking conversions for the full track API and server-side emission.

Browser conversion
statskit.track("activated", { plan: "pro" });