What is A/B Testing?
A/B testing shows two variants (A and B) of a feature to different users to measure which performs better. Server-side means the assignment happens on the backend, not the frontend.
Server-side vs Client-side
Server-side: assignment decided in the backend. More secure, no flickering, works without JavaScript.
Client-side: assignment in the browser. Easier to implement but visible and affects rendering.
Basic implementation
function getVariant(userId: string, experiment: string): 'control' | 'treatment' {
const hash = hashString(`${experiment}:${userId}`);
return hash % 2 === 0 ? 'control' : 'treatment';
}
Key metrics
- Conversion rate: users completing the desired action.
- Revenue: generated income.
- Engagement: time on page, clicks.
- Error rate: error rate in the variant.
Statistical significance
Don't stop the experiment early. You need sufficient sample size. Use hypothesis testing to determine if the difference is significant.
Tools
- Google Optimize, VWO, Optimizely for client-side.
- GrowthBook, Eppo for server-side.
- Statistics: R, Python scipy, online calculators.
Want A/B testing in your product? At Vynta we design experiments to optimize conversions.