Experiment Results
1 バリエーションAn A/B test results card with confidence intervals, a probability-to-beat-control meter, and a ship-the-winner flow.
A/B test
A/B test results with confidence intervals on a zero-lift axis, a probability-to-beat-control meter, and metric tabs that roll every number. Shipping the winner confirms in a dialog, then the status rolls to Shipped and the losing variants fade.
One-page checkout
SignificantDay 14 of 21 · 48,210 users · Primary: Conversion
- Control3.12%Baseline
- One-page3.41%+9.3%One-page: +9.3%, interval +3.1% to +15.6%
- Saved cards first3.05%−2.2%Saved cards first: −2.2%, interval −8.4% to +4.1%
"use client";
import { ExperimentResults } from "@/components/premium/experiment-results";
export function ExperimentResultsAbTestPreview() {
return (
<div className="w-full px-4 py-10">
<ExperimentResults />
</div>
);
}
インストール
API リファレンス
必須と記された props 以外はすべて省略できます。データ、文言、色はサンプルの内容が既定値です。
ExperimentResults9 個の props
experimentExperiment to show. Defaults to the sample checkout test.
ExperimentlabelsText overrides merged over the default labels.
Partial<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }>formattersFormatter overrides for values, lifts, and user counts.
Partial<ExperimentFormatters>targetChance to beat control that counts as a win, 0 to 100. Defaults to 95.
number既定値
95defaultMetricIdMetric tab selected on mount. Defaults to the primary metric.
stringdefaultTrendOpenOpens the cumulative lift chart on mount.
boolean既定値
falseonShipRuns the ship after it is confirmed; a rejected promise shows an error.
((winnerId: string) => void | Promise<void>)onMetricChangeCalled with the metric id when the tab changes.
((metricId: string) => void)classNameClasses merged onto the root element.
string
BeatControlMeter5 個の props
variant必須Leading variant for the selected metric.
ExperimentVariantprobability必須Its chance to beat control, 0 to 100.
numbertarget必須Decision threshold drawn as a target line, 0 to 100.
numberactive必須Fills the track once the card is in view.
booleanlabels必須Text for the caption and target.
Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "target" | "beatControl">
ExperimentStatusPill3 個の props
status必須Status that sets the label and tint.
"running" | "significant" | "shipped"labels必須Status names.
Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, ExperimentStatus>classNameClasses merged onto the root element.
string
IntervalBar9 個の props
low必須Lower bound of the lift interval in percent.
numberhigh必須Upper bound of the lift interval in percent.
numberestimate必須Point estimate of the lift in percent.
numberrange必須Axis half-range in percent; the axis runs from -range to +range.
numberactive必須Collapsed at zero until true, then the interval grows out from zero.
booleandelaySeconds before the first grow-in.
number既定値
0baselineDraws only the zero line and a muted dot, for the control row.
boolean既定値
falselabelAccessible summary, such as "+9.3%, 95% interval +3.1% to +15.6%".
stringclassNameClasses merged onto the root element.
string
LiftTrend6 個の props
points必須Daily cumulative lift, oldest first.
readonly LiftPoint[]viewKey必須Key that replays the draw when the metric changes.
stringopen必須Whether the chart is shown.
booleanonOpenChange必須Called when the disclosure is toggled.
(open: boolean) => voidlabels必須Text for the toggle and caption.
Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "trend" | "trendCaption">formatLift必須Formats the latest lift beside the toggle.
(lift: number) => string
ShipDialog5 個の props
winner必須Variant that will get all traffic.
ExperimentVariantvariants必須Every variant, for the traffic split.
readonly ExperimentVariant[]onConfirm必須Called when the ship is confirmed.
() => voidonCancel必須Called when the dialog is dismissed.
() => voidlabels必須Dialog text.
Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "shipTitle" | ... 3 more ... | "confirm">
VariantRow10 個の props
variant必須Variant shown in this row.
ExperimentVariantresult必須Result for the selected metric.
VariantResultmetric必須Selected metric, passed to the value formatter.
ExperimentMetricrange必須Axis half-range in percent shared by every row.
numberactive必須Grows the interval in once the card is in view.
booleandelay必須Seconds before this row's interval grows in.
numberdimmed必須Fades the row back after another variant ships.
booleanwinner必須Shows the winner tag after shipping.
booleanlabels必須Text for the baseline and winner tags.
Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "users" | ... 1 more ... | "winner">format必須Value, lift, and user formatters.
ExperimentFormatters
型7 個の型
これらの props が受け取るオブジェクト型とそのフィールド。
Experiment7 個のフィールド
name必須Experiment name shown in the header.
stringstatus必須Status when the card mounts. Shipping moves it to "shipped".
ExperimentStatusruntime必須Runtime caption, such as "Day 14 of 21".
stringprimaryMetricId必須Id of the metric that decides the winner.
stringvariants必須Variants, control first.
ExperimentVariant[]metrics必須Metrics, one tab each.
ExperimentMetric[]guardrails必須Guardrail metrics summarized in the footer.
Guardrail[]
ExperimentFormatters3 個のフィールド
value必須Formats a metric value, such as "3.41%" or "$5.12".
(value: number, metric: ExperimentMetric) => stringlift必須Formats a relative lift in percent, such as "+9.3%".
(lift: number) => stringusers必須Formats a user count, such as "48,210".
(users: number) => string
ExperimentVariant5 個のフィールド
id必須Unique id, used as the key in each metric's results.
stringname必須Variant name shown in the row and the ship dialog.
stringtraffic必須Share of traffic in percent, such as 34.
numberisControlMarks the baseline every other variant is compared against.
booleandotClassName必須Dot class that identifies the variant, such as `bg-blue-500`.
string
ExperimentMetric6 個のフィールド
id必須Unique id, used as the tab value.
stringlabel必須Tab and header label, such as "Conversion".
stringkind必須How values read: a percentage or a currency amount.
"percent" | "currency"decimals必須Fraction digits shown for values.
numberresults必須Results keyed by variant id.
Record<string, VariantResult>trend必須Daily cumulative lift of the leading variant, oldest first.
LiftPoint[]
Guardrail2 個のフィールド
name必須Guardrail metric name, such as "Payment errors".
stringstatus必須Ok, watch (drifting), or breach (over its limit).
GuardrailStatus
VariantResult6 個のフィールド
users必須Users counted for this metric.
numbervalue必須Metric value, such as 3.41 for 3.41% or 5.12 for $5.12.
numberlift必須Relative lift vs control in percent. Control uses 0.
numberlow必須Lower bound of the lift's confidence interval in percent.
numberhigh必須Upper bound of the lift's confidence interval in percent.
numberprobability必須Chance to beat control, 0 to 100. Ignored for the control.
number
LiftPoint3 個のフィールド
lift必須Cumulative relative lift on that day in percent.
numberlow必須Lower bound of the confidence band in percent.
numberhigh必須Upper bound of the confidence band in percent.
number