Optimize Conversion Rates in Your React App with This A/B-testing Component
This is a little gem i stumbled upon. Basically you just wrap this around whatever part of your app you want to test, and then hook it up to your analytics tool of choice, and it keeps track of which users got which variant using localStorage
.
For example you could just hook the win
listener up to send an event to Google Analytics with the variantName
and experimentName
as action
and label
.
More advanced use cases
- Multiple
Experiment
components in different places can still keep track of the same experiment (i e users with a blue sign up button always gets a white navbar) - Manually configure weighing (i e A 80%, B 10%, C 10%)
- If you’re mainly testing with logged in users you can use a unique identifier of your choice to keep the experiment consistent for the same user across devices
Links
- NPM: react-ab-test
- GitHub: pushtell/react-ab-test