@fdmg/abdeprecated

A/B Testing Component

Usage no npm install needed!

<script type="module">
  import fdmgAb from 'https://cdn.skypack.dev/@fdmg/ab';
</script>

README

Build Status Coverage Status npm version Greenkeeper badge

fdmg-ab

A/B testing component

Demo

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.