A/B Testing
Run experiments to measure the impact of changes.
Creating an Experiment
- Go to Experiments → New Experiment
- Define your variants:
- Control: Your current implementation
- Variant A: The change you're testing
- Set traffic allocation
- Define success metrics
- 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
- One change at a time: Test a single variable
- Sufficient sample size: Wait for enough data
- Clear hypothesis: Know what you're measuring
- Don't peek: Avoid checking results too early