@@ -9,16 +9,16 @@ const probablityExperimentTypeStoreHeader = {
9
9
[ "Final Hours!" ] : {
10
10
metric1 : 70 ,
11
11
metric2 : 60 ,
12
- metric3 : 60 ,
12
+ metric3 : 50 ,
13
13
metric4 : 20 ,
14
14
} ,
15
15
[ "Sale" ] : {
16
16
metric1 : 70 ,
17
17
metric2 : 60 ,
18
- metric3 : 50 ,
18
+ metric3 : 60 ,
19
19
metric4 : 25 ,
20
20
} ,
21
- [ "New Items" ] : {
21
+ [ "New Items" ] : { //control
22
22
metric1 : 70 ,
23
23
metric2 : 60 ,
24
24
metric3 : 30 ,
@@ -49,48 +49,31 @@ const probablityExperimentTypeStoreHeader = {
49
49
50
50
const probablityExperimentTypeShortenCollection = {
51
51
[ "bayesian" ] : {
52
- [ "Final Hours!" ] : {
53
- metric1 : 70 ,
54
- metric2 : 60 ,
55
- metric3 : 60 ,
56
- metric4 : 20 ,
57
- } ,
58
- [ "Sale" ] : {
59
- metric1 : 70 ,
60
- metric2 : 60 ,
61
- metric3 : 50 ,
62
- metric4 : 25 ,
63
- } ,
64
- [ "New Items" ] : {
52
+ [ "old-long-collections-page" ] : {
65
53
metric1 : 70 ,
66
54
metric2 : 60 ,
67
55
metric3 : 30 ,
68
- metric4 : 20 ,
56
+ } ,
57
+ [ "new-shorten-collections-page" ] : {
58
+ metric1 : 50 ,
59
+ metric2 : 40 ,
60
+ metric3 : 20 ,
69
61
} ,
70
62
} ,
71
63
[ "frequentist" ] : {
72
- [ "Final Hours! " ] : {
64
+ [ "old-long-collections-page " ] : {
73
65
metric1 : 70 ,
74
66
metric2 : 60 ,
75
67
metric3 : 60 ,
76
- metric4 : 20 ,
77
68
} ,
78
- [ "Sale " ] : {
69
+ [ "new-shorten-collections-page " ] : {
79
70
metric1 : 70 ,
80
71
metric2 : 60 ,
81
72
metric3 : 50 ,
82
- metric4 : 25 ,
83
- } ,
84
- [ "New Items" ] : {
85
- metric1 : 70 ,
86
- metric2 : 60 ,
87
- metric3 : 30 ,
88
- metric4 : 20 ,
89
73
} ,
90
74
} ,
91
75
} ;
92
76
93
-
94
77
export const generateStoreHeaderFunnelExperimentResults = async ( {
95
78
client,
96
79
updateContext,
@@ -126,7 +109,9 @@ export const generateStoreHeaderFunnelExperimentResults = async ({
126
109
let stage1metric = Math . random ( ) * 100 ;
127
110
128
111
const metricProbablityObj =
129
- probablityExperimentTypeStoreHeader [ experimentType as keyof typeof probablityExperimentTypeStoreHeader ] ;
112
+ probablityExperimentTypeStoreHeader [
113
+ experimentType as keyof typeof probablityExperimentTypeStoreHeader
114
+ ] ;
130
115
const metricProbablity = metricProbablityObj [ flagVariation as keyof typeof metricProbablityObj ] ;
131
116
if ( stage1metric < metricProbablity . metric1 ) {
132
117
client ?. track ( "store-accessed" , client . getContext ( ) ) ;
@@ -171,9 +156,6 @@ export const generateShortenCollectionsPageFunnelExperimentResults = async ({
171
156
setProgress ( 0 ) ;
172
157
setExpGenerator ( true ) ;
173
158
let totalPrice = 0 ;
174
- let metric1 = 0 ;
175
- let metric2 = 0 ;
176
- let metric3 = 0 ;
177
159
178
160
const experimentType : string = experimentTypeObj . experimentType ;
179
161
@@ -183,30 +165,30 @@ export const generateShortenCollectionsPageFunnelExperimentResults = async ({
183
165
"old-long-collections-page"
184
166
) ;
185
167
168
+ const metricProbablityObj =
169
+ probablityExperimentTypeShortenCollection [
170
+ experimentType as keyof typeof probablityExperimentTypeShortenCollection
171
+ ] ;
172
+ const metricProbablity = metricProbablityObj [ flagVariation as keyof typeof metricProbablityObj ] ;
173
+
186
174
if ( flagVariation === "old-long-collections-page" ) {
187
- metric1 = 50 ;
188
- metric2 = 40 ;
189
- metric3 = 20 ;
190
175
totalPrice = Math . floor ( Math . random ( ) * ( 300 - 200 + 1 ) ) + 200 ;
191
176
}
192
177
if ( flagVariation === "new-shorten-collections-page" ) {
193
- metric1 = 70 ;
194
- metric2 = 60 ;
195
- metric3 = 30 ;
196
178
totalPrice = Math . floor ( Math . random ( ) * ( 500 - 300 + 1 ) ) + 300 ;
197
179
}
198
180
199
181
let stage1metric = Math . random ( ) * 100 ;
200
182
201
- if ( stage1metric < metric1 ) {
183
+ if ( stage1metric < metricProbablity . metric1 ) {
202
184
client ?. track ( "item-added" , client . getContext ( ) ) ;
203
185
let stage2metric = Math . random ( ) * 100 ;
204
186
205
- if ( stage2metric < metric2 ) {
187
+ if ( stage2metric < metricProbablity . metric2 ) {
206
188
client ?. track ( "cart-accessed" , client . getContext ( ) ) ;
207
189
let stage3metric = Math . random ( ) * 100 ;
208
190
209
- if ( stage3metric < metric3 ) {
191
+ if ( stage3metric < metricProbablity . metric3 ) {
210
192
client ?. track ( "customer-checkout" , client . getContext ( ) ) ;
211
193
client ?. track ( "in-cart-total-price" , client . getContext ( ) , totalPrice ) ;
212
194
}
0 commit comments