11# react-optimize
22
33<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
4-
5- [ ![ All Contributors] ( https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square )] ( #contributors- )
6-
4+ [ ![ All Contributors] ( https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square )] ( #contributors- )
75<!-- ALL-CONTRIBUTORS-BADGE:END -->
86
97[ ![ Build Status] ( https://github.com/hudovisk/react-optimize/workflows/Build/badge.svg )] ( https://github.com/hudovisk/react-optimize/actions ) [ ![ Greenkeeper badge] ( https://badges.greenkeeper.io/hudovisk/react-optimize.svg )] ( https://greenkeeper.io/ )
2119yarn add react-optimize
2220```
2321
24- ## How to use
25-
2622You first need to add the gtag snippet with the optimize container id in it. If you are using [ create-react-app] ( https://github.com/facebook/create-react-app )
2723you can add the following to ` public/index.html `
2824
@@ -44,7 +40,10 @@ REACT_APP_GA_ID=UA-xyz
4440REACT_APP_OPTIMIZE_ID=GTM-abc
4541```
4642
47- After that you can use the lib like the following:
43+ ## How to use
44+
45+ #### A/B Test
46+ If the experience is a ** A/B testing** you can use the lib like the following:
4847
4948```
5049import React from 'react';
@@ -69,6 +68,64 @@ class App extends React.Component {
6968}
7069```
7170
71+ #### Multivariate Test
72+ If the experience is a ** multivariate testing** to test variants with two or more different sections. You can use the lib like the following applying the props ** asMtvExperiment (confirm that is multivariate)** and the ** indexSectionPosition** on google optimize like the image below:
73+
74+ ![ google optimize multivariate test] ( ./google-optimize-test.png )
75+
76+ ```
77+ import React from 'react';
78+ import { Experiment, Variant } from "react-optimize";
79+
80+ class App extends React.Component {
81+ render() {
82+ return(
83+ <Experiment
84+ id="<experiment-id>"
85+ asMtvExperiment
86+ indexSectionPosition="0"
87+ >
88+ <Variant id="0">
89+ Original
90+ </Variant>
91+ <Variant id="1">
92+ Variant 1
93+ </Variant>
94+ </Experiment>
95+
96+ <Experiment
97+ id="<experiment-id>"
98+ asMtvExperiment
99+ indexSectionPosition="1"
100+ >
101+ <Variant id="0">
102+ Original
103+ </Variant>
104+ <Variant id="1">
105+ Variant 1
106+ </Variant>
107+ <Variant id="2">
108+ Variant 2
109+ </Variant>
110+ </Experiment>
111+
112+ <Experiment
113+ id="<experiment-id>"
114+ asMtvExperiment
115+ indexSectionPosition="2"
116+ >
117+ <Variant id="0">
118+ Original
119+ </Variant>
120+ <Variant id="1">
121+ Variant 1
122+ </Variant>
123+ </Experiment>
124+ )
125+ }
126+ }
127+ ```
128+
72129## Contributors ✨
73130
74131Thanks goes to these wonderful people ([ emoji key] ( https://allcontributors.org/docs/en/emoji-key ) ):
@@ -78,15 +135,15 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
78135<!-- markdownlint-disable -->
79136<table >
80137 <tr >
81- <td align="center"><a href="https://github.com/hudovisk"><img src="https://avatars2.githubusercontent.com/u/5161722?v=4" width="100px;" alt=""/><br /><sub><b>Hudo Assenco</b></sub></a><br /><a href="https://github.com/hudovisk/react-optimize/commits?author=hudovisk" title="Code">💻</a> <a href="https://github.com/hudovisk/react-optimize/commits?author=hudovisk" title="Documentation">📖</a></td>
82- <td align="center"><a href="http://dobesv.com"><img src="https://avatars2.githubusercontent.com/u/327833?v=4" width="100px;" alt=""/><br /><sub><b>Dobes Vandermeer</b></sub></a><br /><a href="https://github.com/hudovisk/react-optimize/commits?author=dobesv" title="Code">💻</a> <a href="https://github.com/hudovisk/react-optimize/commits?author=dobesv" title="Documentation">📖</a></td>
83- <td align="center"><a href="https://github.com/tlaak"><img src="https://avatars0.githubusercontent.com/u/1674055?v=4" width="100px;" alt=""/><br /><sub><b>Timo Laak</b></sub></a><br /><a href="https://github.com/hudovisk/react-optimize/pulls?q=is%3Apr+reviewed-by%3Atlaak" title="Reviewed Pull Requests">👀</a></td>
138+ <td align="center"><a href="https://github.com/hudovisk"><img src="https://avatars2.githubusercontent.com/u/5161722?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hudo Assenco</b></sub></a><br /><a href="https://github.com/hudovisk/react-optimize/commits?author=hudovisk" title="Code">💻</a> <a href="https://github.com/hudovisk/react-optimize/commits?author=hudovisk" title="Documentation">📖</a></td>
139+ <td align="center"><a href="http://dobesv.com"><img src="https://avatars2.githubusercontent.com/u/327833?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dobes Vandermeer</b></sub></a><br /><a href="https://github.com/hudovisk/react-optimize/commits?author=dobesv" title="Code">💻</a> <a href="https://github.com/hudovisk/react-optimize/commits?author=dobesv" title="Documentation">📖</a></td>
140+ <td align="center"><a href="https://github.com/tlaak"><img src="https://avatars0.githubusercontent.com/u/1674055?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Timo Laak</b></sub></a><br /><a href="https://github.com/hudovisk/react-optimize/pulls?q=is%3Apr+reviewed-by%3Atlaak" title="Reviewed Pull Requests">👀</a></td>
141+ <td align="center"><a href="https://kelvinmaues.github.io/"><img src="https://avatars0.githubusercontent.com/u/11196828?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kelvin Maues</b></sub></a><br /><a href="https://github.com/hudovisk/react-optimize/commits?author=kelvinmaues" title="Code">💻</a> <a href="https://github.com/hudovisk/react-optimize/commits?author=kelvinmaues" title="Documentation">📖</a></td>
84142 </tr >
85143</table >
86144
87- <!-- markdownlint-enable -->
145+ <!-- markdownlint-restore -->
88146<!-- prettier-ignore-end -->
89-
90147<!-- ALL-CONTRIBUTORS-LIST:END -->
91148
92149This project follows the [ all-contributors] ( https://github.com/all-contributors/all-contributors ) specification. Contributions of any kind welcome!
0 commit comments