StaffHQ
Docs/Analytics/Experiments

Experiments

Run A/B tests on your server. Assign players to variants and compare conversion.

Experiments split your players into named variants (for example control and treatment) and let you compare how each group converts through a funnel. Variant assignment is deterministic: the same player always gets the same variant for a given experiment, with no database lookup required at call time.

How it works

Define an experiment in the Experiments page with a stable key, a list of variants and their weights, and a status. Set the status to running to activate it. The plugin polls the dashboard every 60 seconds and caches the running experiments locally. Each call to getVariant() hashes the player UUID together with the experiment key, picks a variant proportionally to its weight, and records an exposure the first time that (experiment, player) pair is resolved.

Plugin SDK

From a Bukkit plugin that depends on StaffHQ, use the convenience wrapper:

java
import net.staffhq.bukkit.StaffHQBukkit;

String variant = StaffHQBukkit.getVariant(player, "checkout_button_color");

if ("treatment".equals(variant)) {
    player.sendMessage("Try our new green button at /shop!");
} else {
    player.sendMessage("Visit /shop to spend your tokens.");
}

From plugin-core or non-Bukkit platforms, use the static API directly with the player's UUID:

java
import com.staffdash.plugin.core.StaffHQ;
import java.util.UUID;

String variant = StaffHQ.getVariant(playerUuid, "checkout_button_color");
Note
Variant assignment is stable across server restarts. The hash uses the experiment key and player UUID only, so the result is reproducible from any StaffHQ server or worker without a shared lookup table.

Compare against a funnel

Once players have been exposed and your funnel events are flowing, open the experiment in the dashboard and pick a funnel from the dropdown. The dashboard runs the same funnel query as the Funnels page, but joins each funnel step against experiment_exposures so you see per-variant counts, % of step 1, and drop-off per step.

Only players that have an exposure record for the experiment are counted. If a variant has zero step-1 entries, it means no exposed players have hit the first funnel event yet within the window.

Status values

An experiment can be in one of three states:

  • draft hidden from the plugin SDK. getVariant() returns control.
  • running served to the plugin. New exposures are recorded.
  • stopped hidden from the plugin SDK. Existing exposure data remains for analysis.

Limitations

  • No automatic stopping rule. You decide when to stop an experiment based on the funnel comparison.
  • No traffic ramp. Weights are fixed, and changing them does not migrate already-exposed players.
  • No statistical significance test in the UI. Use your own tooling on the raw counts.
  • Exposures are deduplicated per (experiment, player). The first variant assigned sticks.
← PreviousFunnelsNext →Analytics