Split testing using React
npm install react-split-testInstall the package with npm i --save react-split-test
##### Usage
To use this plugin you will need to get the components from the plugin using react import/require.
```
const { Experiment, Variation } = require( 'react-split-test' );
To begin you will need to wrap all your variations in an tag.
Variations then can sit within this using .
`js`
Version A
Version B
Original Version
If you wanted to add conditions to the split test then you can do this before the tag and the result from these conditions can be to alter the percent for each .
`js
let testPercent = ConditionA === true ? 50 : 33;
if ( !ConditionB ) testPercent = 0;
Version A
Version B
Original Version
`
##### Cookie to use
_Default: 'variation'_
To use a custom cookie name for variations you can specify it inside the tag.
`js`
Version A
Version B
Original Version
##### Tracking winners
_Default: null_
To use a custom callback function for tracking winning variations you can specify it inside the tag.
`js``
variationWinner( variation ) {
if ( typeof ga === 'undefined' ) return;
ga( 'send', 'variations', 'variation_hit:' + variation );
},
//...
render( ) {
//...
Version A
Version B
Original Version