1
1
# react-optimize
2
2
3
3
<!-- 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- )
7
5
<!-- ALL-CONTRIBUTORS-BADGE:END -->
8
6
9
7
[ ![ 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/ )
21
19
yarn add react-optimize
22
20
```
23
21
24
- ## How to use
25
-
26
22
You 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 )
27
23
you can add the following to ` public/index.html `
28
24
@@ -44,7 +40,10 @@ REACT_APP_GA_ID=UA-xyz
44
40
REACT_APP_OPTIMIZE_ID=GTM-abc
45
41
```
46
42
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:
48
47
49
48
```
50
49
import React from 'react';
@@ -69,6 +68,64 @@ class App extends React.Component {
69
68
}
70
69
```
71
70
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
+
72
129
## Contributors ✨
73
130
74
131
Thanks 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
78
135
<!-- markdownlint-disable -->
79
136
<table >
80
137
<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>
84
142
</tr >
85
143
</table >
86
144
87
- <!-- markdownlint-enable -->
145
+ <!-- markdownlint-restore -->
88
146
<!-- prettier-ignore-end -->
89
-
90
147
<!-- ALL-CONTRIBUTORS-LIST:END -->
91
148
92
149
This project follows the [ all-contributors] ( https://github.com/all-contributors/all-contributors ) specification. Contributions of any kind welcome!
0 commit comments