Skip to content

Commit 10031a8

Browse files
committed
Created experiment api and flag for new experment
1 parent a57b176 commit 10031a8

File tree

2 files changed

+112
-40
lines changed

2 files changed

+112
-40
lines changed

Diff for: .github/workflows/demo_provisioning_scripts/DemoBuilder.py

+112-33
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ def create_flags(self):
146146
self.flag_exp_promotion_banner()
147147
print(" - D2 - Feature Experiment: Suggested Items Carousel")
148148
self.flag_exp_suggestions_carousel()
149+
print(" - D3 - Funnel Experiment: New Shorten Collection Page")
150+
self.flag_exp_shorten_collections_page()
151+
print(" - D4 - Feature Experiment: New Search Engine")
152+
self.flag_exp_new_search_engine()
149153
print(" - E1 - Migration: Database (Migration Tool)")
150154
self.flag_database_migration()
151155

@@ -270,9 +274,9 @@ def run_ecommerce_collection_banner_funnel_experiment(self):
270274
"production",
271275
"Turn on flag for experiment",
272276
)
273-
print(" - 09 - Funnel Experiment: Promotion Banner ")
277+
print(" - 09 - (Bayesian) Funnel Experiment: New Collection Promotion Banner")
274278
self.create_ecommerce_collection_banner_funnel_experiment()
275-
self.ldproject.start_exp_iteration("grow-engagement-with-promotion-banner", "production")
279+
self.ldproject.start_exp_iteration("new-collection-promotion-banner", "production")
276280
print("Done")
277281
self.experiment_created = True
278282

@@ -282,8 +286,8 @@ def create_ecommerce_collection_banner_funnel_experiment(self):
282286
self.ldproject.exp_metric("in-cart-total-price", False)
283287
]
284288
res = self.ldproject.create_experiment(
285-
"grow-engagement-with-promotion-banner",
286-
"Grow engagement with promotion banner",
289+
"new-collection-promotion-banner",
290+
"(Bayesian) Funnel Experiment: New Collection Promotion Banner",
287291
"production",
288292
"storeAttentionCallout",
289293
"If we adjust the header text to better copy we can drive greater attention into the stores in question, and greater conversion of checkout activities.",
@@ -302,9 +306,9 @@ def run_ecommerce_upsell_component_feature_experiment(self):
302306
"production",
303307
"Turn on flag for experiment",
304308
)
305-
print(" - 10 - Feature Experiment: Suggested Items Carousel")
309+
print(" - 10 - (Bayesian) Feature Experiment: Suggested Items Carousel")
306310
self.create_ecommerce_upsell_component_feature_experiment()
307-
self.ldproject.start_exp_iteration("upsell-tracking-experiment", "production")
311+
self.ldproject.start_exp_iteration("suggested-items-carousel", "production")
308312
print("Done")
309313
self.experiment_created = True
310314

@@ -314,43 +318,43 @@ def create_ecommerce_upsell_component_feature_experiment(self):
314318
self.ldproject.exp_metric("in-cart-total-price", False)
315319
]
316320
res = self.ldproject.create_experiment(
317-
"upsell-tracking-experiment",
318-
"Upsell Tracking Experiment",
321+
"suggested-items-carousel",
322+
"(Bayesian) Feature Experiment: Suggested Items Carousel",
319323
"production",
320324
"cartSuggestedItems",
321325
"If we enable the new cart suggested items feature, we can drive greater upsell conversion.",
322326
metrics=metrics,
323327
primary_key="upsell-tracking",
324328
)
325-
329+
#####
326330
def run_ecommerce_shorten_collection_funnel_experiment(self):
327331
if not self.metric_groups_created:
328332
print("Error: Metric groups not created")
329333
return
330334
print("Creating experiment: ")
331335
self.ldproject.toggle_flag(
332-
"storeAttentionCallout",
336+
"release-new-shorten-collections-page",
333337
"on",
334338
"production",
335339
"Turn on flag for experiment",
336340
)
337-
print(" - 09 - Funnel Experiment: Promotion Banner ")
341+
print(" - 11 - (Frequentist) Funnel Experiment: New Shorten Collection Pages")
338342
self.create_ecommerce_shorten_collection_funnel_experiment()
339-
self.ldproject.start_exp_iteration("grow-engagement-with-promotion-banner", "production")
343+
self.ldproject.start_exp_iteration("new-shorten-collection-pages", "production")
340344
print("Done")
341345
self.experiment_created = True
342-
346+
343347
def create_ecommerce_shorten_collection_funnel_experiment(self):
344348
metrics = [
345-
self.ldproject.exp_metric("store-purchases", True),
349+
self.ldproject.exp_metric("shorten-collection-page-increase-conversation-metric-group", True), #TODO: need to get metric key for metric group for shorten collection
346350
self.ldproject.exp_metric("in-cart-total-price", False)
347351
]
348352
res = self.ldproject.create_experiment(
349-
"grow-engagement-with-promotion-banner",
350-
"Grow engagement with promotion banner",
353+
"new-shorten-collection-pages",
354+
"(Frequentist) Funnel Experiment: New Shorten Collection Pages",
351355
"production",
352-
"storeAttentionCallout",
353-
"If we adjust the header text to better copy we can drive greater attention into the stores in question, and greater conversion of checkout activities.",
356+
"release-new-shorten-collections-page",
357+
"We would want to reduce the collection page to the top three items to reduce customer decision fatigue in order to increase checkout and overall revenue.",
354358
metrics=metrics,
355359
primary_key="store-purchases",
356360
)
@@ -361,30 +365,30 @@ def run_ecommerce_new_search_engine_feature_experiment(self):
361365
return
362366
print("Creating experiment: ")
363367
self.ldproject.toggle_flag(
364-
"cartSuggestedItems",
368+
"release-new-search-engine",
365369
"on",
366370
"production",
367371
"Turn on flag for experiment",
368372
)
369-
print(" - 10 - Feature Experiment: Suggested Items Carousel")
373+
print(" - 12 - (Frequentist) Feature Experiment: New Search Engine")
370374
self.create_ecommerce_new_search_engine_feature_experiment()
371-
self.ldproject.start_exp_iteration("upsell-tracking-experiment", "production")
375+
self.ldproject.start_exp_iteration("new-search-engine", "production")
372376
print("Done")
373377
self.experiment_created = True
374378

375379
def create_ecommerce_new_search_engine_feature_experiment(self):
376380
metrics = [
377-
self.ldproject.exp_metric("upsell-tracking", False),
381+
self.ldproject.exp_metric("search-engine-add-to-cart", False),
378382
self.ldproject.exp_metric("in-cart-total-price", False)
379383
]
380384
res = self.ldproject.create_experiment(
381-
"upsell-tracking-experiment",
382-
"Upsell Tracking Experiment",
385+
"new-search-engine",
386+
"(Frequentist) Feature Experiment: New Search Engine",
383387
"production",
384-
"cartSuggestedItems",
385-
"If we enable the new cart suggested items feature, we can drive greater upsell conversion.",
388+
"release-new-search-engine",
389+
"We want to a new search engine that is more ranks search results diffrently and have an Add To Cart button built inside the component in order to increase ease of adding items to cart and increasing revenue.",
386390
metrics=metrics,
387-
primary_key="upsell-tracking",
391+
primary_key="search-engine-add-to-cart",
388392
)
389393

390394
def run_togglebank_ai_config_experiment(self):
@@ -417,7 +421,41 @@ def create_togglebank_ai_config_experiment(self):
417421
metrics=metrics,
418422
primary_key="ai-chatbot-positive-feedback",
419423
)
420-
424+
425+
############################################################################################################
426+
427+
##################################################
428+
# Holdout Definitions
429+
# ----------------
430+
# Each holdout is defined in its own function below
431+
432+
##################################################
433+
# Create all the experiment holdouts
434+
435+
# def create_and_run_experiments(self):
436+
# self.run_ecommerce_collection_banner_funnel_experiment()
437+
# self.run_ecommerce_upsell_component_feature_experiment()
438+
# self.run_ecommerce_shorten_collection_funnel_experiment()
439+
# self.run_ecommerce_new_search_engine_feature_experiment()
440+
# self.run_togglebank_ai_config_experiment()
441+
442+
############################################################################################################
443+
444+
##################################################
445+
# Layers Definitions
446+
# ----------------
447+
# Each layer is defined in its own function below
448+
449+
##################################################
450+
# Create all the experiment layers
451+
452+
# def create_and_run_experiments(self):
453+
# self.run_ecommerce_collection_banner_funnel_experiment()
454+
# self.run_ecommerce_upsell_component_feature_experiment()
455+
# self.run_ecommerce_shorten_collection_funnel_experiment()
456+
# self.run_ecommerce_new_search_engine_feature_experiment()
457+
# self.run_togglebank_ai_config_experiment()
458+
421459
# ############################################################################################################
422460

423461
# Add user id to flags
@@ -1115,11 +1153,11 @@ def flag_exp_promotion_banner(self):
11151153
res = self.ldproject.create_flag(
11161154
"storeAttentionCallout",
11171155
"D1 - Funnel Experiment: Promotion Banner",
1118-
"Promotion Banner for the Galaxy Marketplace",
1156+
"Releasing New Collection Promotion Banner for the Galaxy Marketplace",
11191157
[
11201158
{
11211159
"value": "New Items",
1122-
"name": "Control"
1160+
"name": "(Control) New Items"
11231161
},
11241162
{
11251163
"value": "Sale",
@@ -1139,22 +1177,63 @@ def flag_exp_suggestions_carousel(self):
11391177
res = self.ldproject.create_flag(
11401178
"cartSuggestedItems",
11411179
"D2 - Feature Experiment: Suggested Items Carousel",
1142-
"Suggested Items Carousel for the cart component in Galaxy Marketplace",
1180+
"Releasing New Suggested Items Carousel Component for the cart component in Galaxy Marketplace",
1181+
[
1182+
{
1183+
"value": True,
1184+
"name": "New Suggested Items Carousel"
1185+
},
1186+
{
1187+
"value": False,
1188+
"name": "Old Continue Shopping Button"
1189+
}
1190+
],
1191+
tags=["experiment", "ecommerce"],
1192+
on_variation=0,
1193+
off_variation=1,
1194+
)
1195+
1196+
def flag_exp_shorten_collections_page(self):
1197+
res = self.ldproject.create_flag(
1198+
"release-new-shorten-collections-page",
1199+
"D4 - Funnel Experiment: New Shorten Collection Pages",
1200+
"Release New Shorten Collections Page in Galaxy Marketplace",
11431201
[
11441202
{
11451203
"value": True,
1146-
"name": "Suggested Items Carousel"
1204+
"name": "New Shorten Collections Page"
11471205
},
11481206
{
11491207
"value": False,
1150-
"name": "Continue Shopping Button"
1208+
"name": "Old Longer Collections Page"
1209+
}
1210+
],
1211+
tags=["experiment", "ecommerce"],
1212+
on_variation=0,
1213+
off_variation=1,
1214+
)
1215+
1216+
def flag_exp_new_search_engine(self):
1217+
res = self.ldproject.create_flag(
1218+
"release-new-search-engine",
1219+
"D3 - Feature Experiment: New Search Engine",
1220+
"Release New Search Engine in Galaxy Marketplace",
1221+
[
1222+
{
1223+
"value": "old-search-engine",
1224+
"name": "Old Search Engine"
1225+
},
1226+
{
1227+
"value": "new-search-engine",
1228+
"name": "New Search Engine"
11511229
}
11521230
],
11531231
tags=["experiment", "ecommerce"],
11541232
on_variation=0,
11551233
off_variation=1,
11561234
)
11571235

1236+
11581237
############################################################################################################
11591238
############################################################################################################
11601239

Diff for: pages/marketplace.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ const badgesText = [
4646
];
4747

4848
export default function Marketplace() {
49-
const [headerLabel, setHeaderLabel] = useState<string>("");
50-
const [products, setProducts] = useState<InventoryItem[]>([]);
5149
const [openVRGalaxy, setOpenVRGalaxy] = useState(false);
5250
const [openMacroCenter, setOpenMacroCenter] = useState(false);
5351
const [openBoominBox, setOpenBoominBox] = useState(false);
@@ -79,11 +77,6 @@ export default function Marketplace() {
7977
logLDMetricSent("item-accessed");
8078
};
8179

82-
83-
useEffect(() => {
84-
setHeaderLabel(storeAttentionCallout);
85-
}, [storeAttentionCallout]);
86-
8780
const handleOnSelect = (item: InventoryItem) => {
8881
let openShoppingCart: HTMLElement = document?.querySelector(
8982
".shopping-cart-trigger"

0 commit comments

Comments
 (0)