Skip to content

A/B Testing

Run experiments to measure the impact of changes.

Creating an Experiment

  1. Go to ExperimentsNew Experiment
  2. Define your variants:
    • Control: Your current implementation
    • Variant A: The change you're testing
  3. Set traffic allocation
  4. Define success metrics
  5. Start the experiment

Code Integration

typescript
// Get the variant for a user
const variant = await client.getVariant('checkout-experiment', {
  userId: 'user-123'
})

switch (variant) {
  case 'control':
    showOldCheckout()
    break
  case 'variant-a':
    showNewCheckout()
    break
  default:
    showOldCheckout()
}

Tracking Conversions

Track events to measure experiment impact:

typescript
// Track when user completes purchase
await client.track('purchase_completed', {
  userId: 'user-123',
  properties: {
    experimentId: 'checkout-experiment',
    variant: variant,
    revenue: 49.99
  }
})

Analyzing Results

The dashboard shows:

  • Conversion rate per variant
  • Statistical significance
  • Confidence interval
  • Sample size

TIP

Wait for 95% statistical significance before making decisions.

Best Practices

  1. One change at a time: Test a single variable
  2. Sufficient sample size: Wait for enough data
  3. Clear hypothesis: Know what you're measuring
  4. Don't peek: Avoid checking results too early

Built with VitePress