Skip to content

Commit c0b4d8a

Browse files
committed
updated frequentist funnel
1 parent d14d2b7 commit c0b4d8a

File tree

1 file changed

+23
-41
lines changed

1 file changed

+23
-41
lines changed

Diff for: experimentation-automation/funnelExperimentGeneratorFunctions.ts

+23-41
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ const probablityExperimentTypeStoreHeader = {
99
["Final Hours!"]: {
1010
metric1: 70,
1111
metric2: 60,
12-
metric3: 60,
12+
metric3: 50,
1313
metric4: 20,
1414
},
1515
["Sale"]: {
1616
metric1: 70,
1717
metric2: 60,
18-
metric3: 50,
18+
metric3: 60,
1919
metric4: 25,
2020
},
21-
["New Items"]: {
21+
["New Items"]: { //control
2222
metric1: 70,
2323
metric2: 60,
2424
metric3: 30,
@@ -49,48 +49,31 @@ const probablityExperimentTypeStoreHeader = {
4949

5050
const probablityExperimentTypeShortenCollection = {
5151
["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"]: {
6553
metric1: 70,
6654
metric2: 60,
6755
metric3: 30,
68-
metric4: 20,
56+
},
57+
["new-shorten-collections-page"]: {
58+
metric1: 50,
59+
metric2: 40,
60+
metric3: 20,
6961
},
7062
},
7163
["frequentist"]: {
72-
["Final Hours!"]: {
64+
["old-long-collections-page"]: {
7365
metric1: 70,
7466
metric2: 60,
7567
metric3: 60,
76-
metric4: 20,
7768
},
78-
["Sale"]: {
69+
["new-shorten-collections-page"]: {
7970
metric1: 70,
8071
metric2: 60,
8172
metric3: 50,
82-
metric4: 25,
83-
},
84-
["New Items"]: {
85-
metric1: 70,
86-
metric2: 60,
87-
metric3: 30,
88-
metric4: 20,
8973
},
9074
},
9175
};
9276

93-
9477
export const generateStoreHeaderFunnelExperimentResults = async ({
9578
client,
9679
updateContext,
@@ -126,7 +109,9 @@ export const generateStoreHeaderFunnelExperimentResults = async ({
126109
let stage1metric = Math.random() * 100;
127110

128111
const metricProbablityObj =
129-
probablityExperimentTypeStoreHeader[experimentType as keyof typeof probablityExperimentTypeStoreHeader];
112+
probablityExperimentTypeStoreHeader[
113+
experimentType as keyof typeof probablityExperimentTypeStoreHeader
114+
];
130115
const metricProbablity = metricProbablityObj[flagVariation as keyof typeof metricProbablityObj];
131116
if (stage1metric < metricProbablity.metric1) {
132117
client?.track("store-accessed", client.getContext());
@@ -171,9 +156,6 @@ export const generateShortenCollectionsPageFunnelExperimentResults = async ({
171156
setProgress(0);
172157
setExpGenerator(true);
173158
let totalPrice = 0;
174-
let metric1 = 0;
175-
let metric2 = 0;
176-
let metric3 = 0;
177159

178160
const experimentType: string = experimentTypeObj.experimentType;
179161

@@ -183,30 +165,30 @@ export const generateShortenCollectionsPageFunnelExperimentResults = async ({
183165
"old-long-collections-page"
184166
);
185167

168+
const metricProbablityObj =
169+
probablityExperimentTypeShortenCollection[
170+
experimentType as keyof typeof probablityExperimentTypeShortenCollection
171+
];
172+
const metricProbablity = metricProbablityObj[flagVariation as keyof typeof metricProbablityObj];
173+
186174
if (flagVariation === "old-long-collections-page") {
187-
metric1 = 50;
188-
metric2 = 40;
189-
metric3 = 20;
190175
totalPrice = Math.floor(Math.random() * (300 - 200 + 1)) + 200;
191176
}
192177
if (flagVariation === "new-shorten-collections-page") {
193-
metric1 = 70;
194-
metric2 = 60;
195-
metric3 = 30;
196178
totalPrice = Math.floor(Math.random() * (500 - 300 + 1)) + 300;
197179
}
198180

199181
let stage1metric = Math.random() * 100;
200182

201-
if (stage1metric < metric1) {
183+
if (stage1metric < metricProbablity.metric1) {
202184
client?.track("item-added", client.getContext());
203185
let stage2metric = Math.random() * 100;
204186

205-
if (stage2metric < metric2) {
187+
if (stage2metric < metricProbablity.metric2) {
206188
client?.track("cart-accessed", client.getContext());
207189
let stage3metric = Math.random() * 100;
208190

209-
if (stage3metric < metric3) {
191+
if (stage3metric < metricProbablity.metric3) {
210192
client?.track("customer-checkout", client.getContext());
211193
client?.track("in-cart-total-price", client.getContext(), totalPrice);
212194
}

0 commit comments

Comments
 (0)