How it Works
The A/B testing system utilizes a mathematical approach to assign users to different test buckets. This ensures a fair and unbiased distribution, allowing you to accurately compare the performance of different variations. Users are assigned to a specific bucket based on a random number generator and percentage allocation calculations. This ensures that each user consistently sees the same variation throughout their session, providing a controlled testing environment.Configuration
By default, A/B testing is enabled only on the homepage to showcase the feature. To activate it on other pages, follow these steps:- Edit the
ROUTES
constant in themiddleware.ts
file.
middleware.ts
- Add an entry for the desired route, specifying the page (pathname), cookie name, and available buckets.
- Modify the corresponding page component to accept a
[bucket]
parameter in its route (e.g.,app/category/[slug]/[bucket]/page.tsx
).