fdmg-ab
A/B testing component
Demo
- https://fdmg-ts-react-ab.fdmediagroep.now.sh/demo
- Debug settings: https://fdmg-ts-react-ab.fdmediagroep.now.sh/demo?debugAB=true
Installation
- Run
npm i -D @fdmg/ab
Usage
import { Experiment, Variant, ABProvider } from "@fdmg/ab";
...
<ABProvider>
...
<Experiment
name="Globally unique experiment name"
debugUriParam="ABdebug=true"
onClick={console.log}
onRunExperiment={console.log}
>
<Variant name="A" onClick={console.log}>
<h1>Headline 1</h1>
</Variant>
<Variant name="B" onClick={console.log}>
<h1>Headline 2</h1>
</Variant>
</Experiment>
...
</ABProvider>
...
ABProvider component provides a context which manages cookies. The cookies are used to store variants shown to the user so subsequent visits show the same variants for that user.