@@ -39,9 +39,9 @@ def build(self):
39
39
self .update_add_userid_to_flags ()
40
40
self .setup_release_pipeline ()
41
41
self .create_ai_config ()
42
- self .create_and_run_holdout ()
43
- self .create_and_run_layer ()
44
42
self .create_and_run_experiments ()
43
+ self .create_and_run_layer ()
44
+ self .create_and_run_holdout ()
45
45
self .project_settings ()
46
46
self .setup_template_environment ()
47
47
@@ -144,7 +144,7 @@ def create_flags(self):
144
144
self .flag_togglebank_api_guarded_release ()
145
145
print (" - B1 - Release: New Database (Guarded Release)" )
146
146
self .flag_database_guarded_release ()
147
- print (" - B2 - Release: New API (Guarded Release)" )
147
+ print (" - B2 - Release: New API (Guarded Release)" )
148
148
self .flag_api_guarded_release ()
149
149
#print(" - C1 - Experiment: AI Models for Chatbot")
150
150
#self.flag_exp_chatbot_ai_models()
@@ -156,6 +156,8 @@ def create_flags(self):
156
156
self .flag_exp_new_search_engine ()
157
157
print (" - D4 - Funnel Experiment: New Shorten Collection Page" )
158
158
self .flag_exp_shorten_collections_page ()
159
+ print (" - Flag to Create Q4 Increase Total Price Holdout" )
160
+ self .flag_holdout_q4_increase_incart_price ()
159
161
print (" - E1 - Migration: Database (Migration Tool)" )
160
162
self .flag_database_migration ()
161
163
@@ -294,8 +296,7 @@ def run_ecommerce_collection_banner_funnel_experiment(self):
294
296
)
295
297
print (" - (Bayesian) Funnel Experiment: New Collection Promotion Banner" )
296
298
self .create_ecommerce_collection_banner_funnel_experiment ()
297
- self .ldproject .start_exp_iteration ("new-collection-promotion-banner" , "production" )
298
- print ("Done" )
299
+ print ("Done creating experiment" )
299
300
self .experiment_created = True
300
301
301
302
def create_ecommerce_collection_banner_funnel_experiment (self ):
@@ -311,6 +312,7 @@ def create_ecommerce_collection_banner_funnel_experiment(self):
311
312
"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." ,
312
313
metrics = metrics ,
313
314
primary_key = "store-purchases" ,
315
+ attributes = ["device" , "location" , "tier" , "operating_system" ]
314
316
)
315
317
316
318
def run_ecommerce_upsell_component_feature_experiment (self ):
@@ -326,8 +328,6 @@ def run_ecommerce_upsell_component_feature_experiment(self):
326
328
)
327
329
print (" - (Bayesian) Feature Experiment: Suggested Items Carousel" )
328
330
self .create_ecommerce_upsell_component_feature_experiment ()
329
- self .ldproject .start_exp_iteration ("suggested-items-carousel" , "production" )
330
- print ("Done" )
331
331
self .experiment_created = True
332
332
333
333
def create_ecommerce_upsell_component_feature_experiment (self ):
@@ -343,8 +343,9 @@ def create_ecommerce_upsell_component_feature_experiment(self):
343
343
"If we enable the new cart suggested items feature, we can drive greater upsell conversion." ,
344
344
metrics = metrics ,
345
345
primary_key = "in-cart-total-items" ,
346
+ attributes = ["device" , "location" , "tier" , "operating_system" ]
346
347
)
347
- #####
348
+
348
349
def run_ecommerce_shorten_collection_funnel_experiment (self ):
349
350
if not self .metric_groups_created :
350
351
print ("Error: Metric groups not created" )
@@ -375,6 +376,9 @@ def create_ecommerce_shorten_collection_funnel_experiment(self):
375
376
"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." ,
376
377
metrics = metrics ,
377
378
primary_key = "shorten-collection-page-metric-group" ,
379
+ methodology = "frequentist" ,
380
+ analysisConfig = {"significanceThreshold" : "5" , "testDirection" : "two-sided" },
381
+ attributes = ["device" , "location" , "tier" , "operating_system" ]
378
382
)
379
383
380
384
def run_ecommerce_new_search_engine_feature_experiment (self ):
@@ -391,7 +395,6 @@ def run_ecommerce_new_search_engine_feature_experiment(self):
391
395
print (" - (Frequentist) Feature Experiment: New Search Engine" )
392
396
self .create_ecommerce_new_search_engine_feature_experiment ()
393
397
self .ldproject .start_exp_iteration ("new-search-engine" , "production" )
394
- print ("Done" )
395
398
self .experiment_created = True
396
399
397
400
def create_ecommerce_new_search_engine_feature_experiment (self ):
@@ -407,6 +410,9 @@ def create_ecommerce_new_search_engine_feature_experiment(self):
407
410
hypothesis = "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." ,
408
411
metrics = metrics ,
409
412
primary_key = "search-engine-add-to-cart" ,
413
+ methodology = "frequentist" ,
414
+ analysisConfig = {"significanceThreshold" : "5" , "testDirection" : "two-sided" },
415
+ attributes = ["device" , "location" , "tier" , "operating_system" ]
410
416
)
411
417
412
418
def run_togglebank_ai_config_experiment (self ):
@@ -422,7 +428,6 @@ def run_togglebank_ai_config_experiment(self):
422
428
)
423
429
self .create_togglebank_ai_config_experiment ()
424
430
self .ldproject .start_exp_iteration ("ai-config-experiment" , "production" )
425
- print ("Done" )
426
431
self .experiment_created = True
427
432
428
433
def create_togglebank_ai_config_experiment (self ):
@@ -438,6 +443,7 @@ def create_togglebank_ai_config_experiment(self):
438
443
"Which AI Models are providing best experiences to customers and delivering best responses" ,
439
444
metrics = metrics ,
440
445
primary_key = "ai-chatbot-positive-feedback" ,
446
+ attributes = ["device" , "location" , "tier" , "operating_system" ]
441
447
)
442
448
443
449
############################################################################################################
@@ -451,15 +457,15 @@ def create_togglebank_ai_config_experiment(self):
451
457
# Create all the experiment holdouts
452
458
453
459
def create_and_run_holdout (self ):
454
- print ("Creating holdout: " )
460
+ print (" - Creating holdout: " )
455
461
self .run_q4_increase_incart_price_holdout ()
456
462
457
463
def run_q4_increase_incart_price_holdout (self ):
458
464
metrics = [
459
465
{
460
466
"key" : "in-cart-total-price" ,
461
467
"isGroup" : False ,
462
- "primarySingleMetricKey " : True
468
+ "primary " : True
463
469
}
464
470
]
465
471
res = self .ldproject .create_holdout (
@@ -471,7 +477,7 @@ def run_q4_increase_incart_price_holdout(self):
471
477
primary_metric_key = "in-cart-total-price" ,
472
478
randomization_unit = "users" ,
473
479
attributes = ["tier" ],
474
- prerequisiteflagkey = "release-new-search-engine "
480
+ prerequisiteflagkey = "q-4-increase-average-total-in-cart-price-ld-holdout "
475
481
)
476
482
############################################################################################################
477
483
@@ -481,19 +487,24 @@ def run_q4_increase_incart_price_holdout(self):
481
487
# Each layer is defined in its own function below
482
488
483
489
##################################################
484
- # Create all the experiment layers
490
+ # Create all the experiment layers
485
491
486
492
def create_and_run_layer (self ):
487
- print ("Creating checkout_experiment layer: " )
493
+ print (" - Creating checkout_experiment layer: " )
488
494
self .run_checkout_experiment_layer ()
489
- print ("Updating checkout_experiment layer with experiments: " )
495
+ print (" - Updating checkout_experiment layer with experiments: " )
490
496
self .update_checkout_experiment_layer ()
497
+ print (" - Done updating layer" )
498
+ print (" - Start running suggested-items-carousel experiment: " )
499
+ self .ldproject .start_exp_iteration ("suggested-items-carousel" , "production" )
500
+ print (" - Start running new-collection-promotion-banner: " )
501
+ self .ldproject .start_exp_iteration ("new-collection-promotion-banner" , "production" )
491
502
print ("Done" )
492
503
493
504
def run_checkout_experiment_layer (self ):
494
505
res = self .ldproject .create_layer (
495
- layer_key = "checkout-experiment-layer" ,
496
- layer_name = "Checkout Experiment Layer" ,
506
+ # layer_key= "checkout-experiment-layer",
507
+ # layer_name="Checkout Experiment Layer",
497
508
description = "This layer is to allow having two experiments that affect the checkout cart running at the same time." ,
498
509
)
499
510
@@ -567,7 +578,7 @@ def add_userid_to_flags(self):
567
578
res = self .ldproject .add_maintainer_to_flag ("debuggingModeForDevelopers" )
568
579
res = self .ldproject .add_maintainer_to_flag ("release-new-search-engine" )
569
580
res = self .ldproject .add_maintainer_to_flag ("release-new-shorten-collections-page" )
570
-
581
+ res = self . ldproject . add_maintainer_to_flag ( "q-4-increase-average-total-in-cart-price-ld-holdout" )
571
582
# ############################################################################################################
572
583
573
584
# Update project settings
@@ -1189,7 +1200,7 @@ def flag_database_guarded_release(self):
1189
1200
def flag_api_guarded_release (self ):
1190
1201
res = self .ldproject .create_flag (
1191
1202
"release-new-investment-stock-api" ,
1192
- "B2 - Release: New API (Guarded Release) - Investment" ,
1203
+ "B2 - Release: New API (Guarded Release) - Investment" ,
1193
1204
"Release new API for stocks component" ,
1194
1205
[
1195
1206
{
@@ -1322,10 +1333,28 @@ def flag_exp_new_search_engine(self):
1322
1333
},
1323
1334
],
1324
1335
tags = ["experiment" , "ecommerce" ],
1336
+ on_variation = 0 ,
1337
+ off_variation = 1 ,
1338
+ )
1339
+
1340
+ def flag_holdout_q4_increase_incart_price (self ):
1341
+ res = self .ldproject .create_flag (
1342
+ "q-4-increase-average-total-in-cart-price-ld-holdout" ,
1343
+ "Flag to Create Q4 Increase Total Price Holdout" ,
1344
+ "Description: Flag to create holdout for q4 increase incart price" ,
1345
+ [
1346
+ {
1347
+ "value" : True ,
1348
+ "name" : "In holdout"
1349
+ },
1350
+ {
1351
+ "value" : False ,
1352
+ "name" : "Not In holdout"
1353
+ },
1354
+ ],
1325
1355
purpose = "holdout" ,
1326
1356
on_variation = 0 ,
1327
1357
off_variation = 1 ,
1328
- # maintainerId=self.user_id
1329
1358
)
1330
1359
1331
1360
@@ -1907,7 +1936,7 @@ def rp_detailed_spending_insights_reports(self):
1907
1936
if not self .phase_ids :
1908
1937
self .phase_ids = self .ldproject .get_pipeline_phase_ids ("togglebank-v2-pipeline" )
1909
1938
self .ldproject .advance_flag_phase ("detailedSpendingInsightsReports" , "active" , self .phase_ids ["test" ])
1910
- self .ldproject .advance_flag_phase ("detailedSpendingInsightsReports" , "active" , self .phase_ids ["guard" ])
1939
+ self .ldproject .advance_flag_phase ("detailedSpendingInsightsReports" , "active" , self .phase_ids ["guard" ], guarded = True )
1911
1940
self .ldproject .advance_flag_phase ("detailedSpendingInsightsReports" , "active" , self .phase_ids ["ga" ])
1912
1941
1913
1942
def rp_scheduled_bill_payments (self ):
@@ -1916,7 +1945,7 @@ def rp_scheduled_bill_payments(self):
1916
1945
if not self .phase_ids :
1917
1946
self .phase_ids = self .ldproject .get_pipeline_phase_ids ("togglebank-v2-pipeline" )
1918
1947
self .ldproject .advance_flag_phase ("scheduledBillPayments" , "active" , self .phase_ids ["test" ])
1919
- self .ldproject .advance_flag_phase ("scheduledBillPayments" , "active" , self .phase_ids ["guard" ])
1948
+ self .ldproject .advance_flag_phase ("scheduledBillPayments" , "active" , self .phase_ids ["guard" ], guarded = True )
1920
1949
self .ldproject .advance_flag_phase ("scheduledBillPayments" , "active" , self .phase_ids ["ga" ])
1921
1950
1922
1951
def rp_cross_border_payment_simplification (self ):
@@ -1925,23 +1954,23 @@ def rp_cross_border_payment_simplification(self):
1925
1954
if not self .phase_ids :
1926
1955
self .phase_ids = self .ldproject .get_pipeline_phase_ids ("togglebank-v2-pipeline" )
1927
1956
self .ldproject .advance_flag_phase ("crossBorderPaymentSimplification" , "active" , self .phase_ids ["test" ])
1928
- self .ldproject .advance_flag_phase ("crossBorderPaymentSimplification" , "active" , self .phase_ids ["guard" ])
1957
+ self .ldproject .advance_flag_phase ("crossBorderPaymentSimplification" , "active" , self .phase_ids ["guard" ], guarded = True )
1929
1958
1930
1959
def rp_merchant_rewards_integration (self ):
1931
1960
res = self .ldproject .add_pipeline_flag ("merchantRewardsIntegration" , "togglebank-v2-pipeline" )
1932
1961
self .ldproject .attach_metric_to_flag ("merchantRewardsIntegration" , ["stocks-api-latency" ,"stocks-api-error-rates" ])
1933
1962
if not self .phase_ids :
1934
1963
self .phase_ids = self .ldproject .get_pipeline_phase_ids ("togglebank-v2-pipeline" )
1935
1964
self .ldproject .advance_flag_phase ("merchantRewardsIntegration" , "active" , self .phase_ids ["test" ])
1936
- self .ldproject .advance_flag_phase ("merchantRewardsIntegration" , "active" , self .phase_ids ["guard" ])
1965
+ self .ldproject .advance_flag_phase ("merchantRewardsIntegration" , "active" , self .phase_ids ["guard" ], guarded = True )
1937
1966
1938
1967
def rp_virtual_card_issuance (self ):
1939
1968
res = self .ldproject .add_pipeline_flag ("virtualCardIssuance" , "togglebank-v2-pipeline" )
1940
1969
self .ldproject .attach_metric_to_flag ("virtualCardIssuance" , ["stocks-api-latency" ,"stocks-api-error-rates" ])
1941
1970
if not self .phase_ids :
1942
1971
self .phase_ids = self .ldproject .get_pipeline_phase_ids ("togglebank-v2-pipeline" )
1943
1972
self .ldproject .advance_flag_phase ("virtualCardIssuance" , "active" , self .phase_ids ["test" ])
1944
- self .ldproject .advance_flag_phase ("virtualCardIssuance" , "active" , self .phase_ids ["guard" ])
1973
+ self .ldproject .advance_flag_phase ("virtualCardIssuance" , "active" , self .phase_ids ["guard" ], guarded = True )
1945
1974
self .ldproject .advance_flag_phase ("virtualCardIssuance" , "active" , self .phase_ids ["ga" ])
1946
1975
1947
1976
def rp_api_support_for_third_party_applications (self ):
@@ -1950,7 +1979,7 @@ def rp_api_support_for_third_party_applications(self):
1950
1979
if not self .phase_ids :
1951
1980
self .phase_ids = self .ldproject .get_pipeline_phase_ids ("togglebank-v2-pipeline" )
1952
1981
self .ldproject .advance_flag_phase ("apiSupportForThirdPartyApplications" , "active" , self .phase_ids ["test" ])
1953
- self .ldproject .advance_flag_phase ("apiSupportForThirdPartyApplications" , "active" , self .phase_ids ["guard" ])
1982
+ self .ldproject .advance_flag_phase ("apiSupportForThirdPartyApplications" , "active" , self .phase_ids ["guard" ], guarded = True )
1954
1983
self .ldproject .advance_flag_phase ("apiSupportForThirdPartyApplications" , "active" , self .phase_ids ["ga" ])
1955
1984
1956
1985
############################################################################################################
0 commit comments