Skip to Content

Experiment Screens

Admin screens for A/B experiments: a list, a per-variant results readout, a create and edit form, and a pricing readout.

onboarding-checklist

Running

Checklist on the first screen

Goal: activated

Each variant is compared with the control by a two-proportion z-test; significant below p = 0.05.
VariantWeightExposedConvertedRateLiftp-value
controlControl50184031217.0%––
checklist50182239121.5%+26.5%<0.001Significant

import { ExperimentResults } from "@dapplelight/signet-ui/screens/experiment-screens"
import { experiments, results } from "./experiments"

function ExperimentResultsDemo() {
  return (
    <ExperimentResults
      className="w-full max-w-3xl"
      experiment={experiments[0]}
      results={results}
      onStop={() => undefined}
      onRollout={() => undefined}
    />
  )
}

Installation

npm i @dapplelight/signet-ui

Usage

import {
  ExperimentList,
  ExperimentResults,
  ExperimentForm,
  PricingExperimentResults,
} from "@dapplelight/signet-ui/screens/experiment-screens"

Data is shaped like signet-db's createExperiments results or the experimentAdminRoutes JSON; actions come out as callbacks that may be async. An action that throws or resolves false shows the failure message.

import { ExperimentResults } from "@dapplelight/signet-ui/screens/experiment-screens"
import { experiment, results, stop } from "./experiments"

<ExperimentResults experiment={experiment} results={results} onStop={stop} />

Examples

ExperimentList

Experiments

import { useState } from "react"
import { ExperimentList } from "@dapplelight/signet-ui/screens/experiment-screens"
import { experiments } from "./experiments"

function ExperimentListDemo() {
  const [selected, setSelected] = useState("onboarding-checklist")
  return (
    <ExperimentList
      className="w-full max-w-xl"
      experiments={experiments}
      selected={selected}
      onSelect={setSelected}
    />
  )
}

ExperimentResults

onboarding-checklist

Running

Checklist on the first screen

Goal: activated

Each variant is compared with the control by a two-proportion z-test; significant below p = 0.05.
VariantWeightExposedConvertedRateLiftp-value
controlControl50184031217.0%––
checklist50182239121.5%+26.5%<0.001Significant

import { ExperimentResults } from "@dapplelight/signet-ui/screens/experiment-screens"
import { experiments, results } from "./experiments"

function ExperimentResultsDemo() {
  return (
    <ExperimentResults
      className="w-full max-w-3xl"
      experiment={experiments[0]}
      results={results}
      onStop={() => undefined}
      onRollout={() => undefined}
    />
  )
}

ExperimentForm

Edit annual-first-paywall

Draft
The analytics event that counts as a conversion.
Variants

import { ExperimentForm } from "@dapplelight/signet-ui/screens/experiment-screens"
import { experiments } from "./experiments"

function ExperimentFormDemo() {
  return (
    <ExperimentForm
      className="w-full max-w-xl"
      experiment={experiments[1]}
      onSubmit={() => true}
      onStart={() => undefined}
    />
  )
}

PricingExperimentResults

annual-first-paywall

Running

Running on onboarding

Conversion is a trial or purchase after exposure, compared with the control by a two-proportion z-test (significant below p = 0.05). Revenue is charges minus refunds after exposure. LTV is an estimate: the average charge times the payments expected from observed churn.
VariantOfferingExposedConversionLiftp-valueTrial conversionRevenue / exposed userLTV (estimate)
monthly-firstControlpro-monthly24007.0%––29.0%$0.70~$54
annual-firstpro-annual23809.0%+28.6%0.011Significant35.0%$1.08~$62

import { PricingExperimentResults, type PricingReadoutView } from "@dapplelight/signet-ui/screens/experiment-screens"
import { experiments } from "./experiments"

function PricingExperimentResultsDemo() {
  const readout: PricingReadoutView = {
    placements: ["onboarding"],
    alpha: 0.05,
    control: "monthly-first",
    variants: [
      {
        key: "monthly-first",
        offering: { offering: "pro-monthly" },
        exposed: 2400,
        converted: 168,
        rate: 0.07,
        lift: null,
        pValue: null,
        significant: false,
        trials: 410,
        trialConverted: 120,
        trialConversion: 0.29,
        revenue: { USD: 167832 },
        revenuePerExposed: { USD: 70 },
        ltv: { estimate: true, perCurrency: { USD: 5400 }, churn: 0.08, expectedPayments: 12 },
      },
      {
        key: "annual-first",
        offering: { offering: "pro-annual" },
        exposed: 2380,
        converted: 214,
        rate: 0.09,
        lift: 0.2857,
        pValue: 0.011,
        significant: true,
        trials: 430,
        trialConverted: 150,
        trialConversion: 0.35,
        revenue: { USD: 256800 },
        revenuePerExposed: { USD: 108 },
        ltv: { estimate: true, perCurrency: { USD: 6200 }, churn: 0.06, expectedPayments: 16 },
      },
    ],
  }
  return (
    <PricingExperimentResults
      className="w-full max-w-4xl"
      experiment={{ ...experiments[1], status: "running" }}
      readout={readout}
      onRollout={() => undefined}
      onStop={() => undefined}
    />
  )
}

API Reference

All screens also accept the props of their root element and labels (Partial<ExperimentLabels>, defaults in DEFAULT_EXPERIMENT_LABELS).

ExperimentList

PropTypeDefaultDescription
experimentsreadonly ExperimentView[]requiredExperiments to list.
selectedstring-Key of the experiment shown, marked aria-current.
onSelect(key: string) => void-Called when one is picked.

ExperimentResults

PropTypeDefaultDescription
experimentExperimentViewrequiredThe experiment.
resultsExperimentResultsView | null-Per-variant results; null when the server has no events table.
onStart() => unknown-Start or resume.
onStop() => unknown-Stop.
onRollout(variant: string) => unknown-Roll out a variant.

ExperimentForm

PropTypeDefaultDescription
experimentExperimentView-The experiment to edit; omitted creates one.
offeringsreadonly OfferingChoice[]-Offerings to pick per variant (pricing experiment); omitted shows a JSON value field.
onSubmit(input: ExperimentInputView) => unknownrequiredCreate or save. Resolve false or throw to show the failure.
onStart() => unknown-Start the experiment.
onStop() => unknown-Stop the experiment.

PricingExperimentResults

PropTypeDefaultDescription
experimentExperimentViewrequiredThe experiment.
readoutPricingReadoutViewrequiredPer-variant offering, conversion, trial conversion, revenue and LTV.
onRollout(variant: string) => unknown-Make a variant's offering the placement's offering.
onStart() => unknown-Start the experiment.
onStop() => unknown-Stop the experiment.

ExperimentStatusBadge

PropTypeDefaultDescription
status"draft" | "running" | "stopped" | "rolled_out"requiredStatus to show.
labelsPartial<ExperimentLabels>-Override any string.