From 750b05035856c54e44f3ce089ecf6d21076b7640 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 15 Oct 2014 16:21:45 +0100 Subject: [PATCH] added ab test in for multi currency --- services/web/app/views/subscriptions/new.jade | 9 ++++- .../web/app/views/subscriptions/plans.jade | 1 + .../successful_subscription.jade | 9 ++++- .../coffee/analytics/AbTestingManager.coffee | 2 +- .../coffee/main/new-subscription.coffee | 14 ++++++- services/web/public/coffee/main/plans.coffee | 37 ++++++++++++++----- 6 files changed, 56 insertions(+), 16 deletions(-) diff --git a/services/web/app/views/subscriptions/new.jade b/services/web/app/views/subscriptions/new.jade index 3cd4af749d..6a3c845095 100644 --- a/services/web/app/views/subscriptions/new.jade +++ b/services/web/app/views/subscriptions/new.jade @@ -13,7 +13,6 @@ block content .content.content-alt .container(ng-controller="NewSubscriptionController" ng-cloak) .row.card-group - .col-md-6.col-md-push-3 .card.card-highlighted .page-header @@ -82,5 +81,11 @@ block content window.ab = [ {step:1, bucket:"14d", testName:"trial_len"}, - {step:1, bucket:"7d", testName:"trial_len"} + {step:1, bucket:"7d", testName:"trial_len"}, + + {step:1, bucket:"eu-eu", testName:"multi_currency"}, + {step:1, bucket:"eu-usd", testName:"multi_currency"} + + ] + diff --git a/services/web/app/views/subscriptions/plans.jade b/services/web/app/views/subscriptions/plans.jade index 9af082de01..f5a0a192b3 100644 --- a/services/web/app/views/subscriptions/plans.jade +++ b/services/web/app/views/subscriptions/plans.jade @@ -2,6 +2,7 @@ extends ../layout block scripts script(type='text/javascript'). window.recomendedCurrency = '#{recomendedCurrency}' + window.abCurrencyFlag = '#{abCurrencyFlag}' block content .content-alt .content.plans(ng-controller="PlansController") diff --git a/services/web/app/views/subscriptions/successful_subscription.jade b/services/web/app/views/subscriptions/successful_subscription.jade index faee3cd9d5..5d989fdf6e 100644 --- a/services/web/app/views/subscriptions/successful_subscription.jade +++ b/services/web/app/views/subscriptions/successful_subscription.jade @@ -36,5 +36,12 @@ block content script(type="text/javascript"). window.ab = [ {step:2, bucket:"14d", testName:"trial_len"}, - {step:2, bucket:"7d", testName:"trial_len"} + {step:2, bucket:"7d", testName:"trial_len"}, + {step:2, bucket:"eu-eu", testName:"multi_currency"}, + {step:2, bucket:"eu-usd", testName:"multi_currency"}, + + {step:1, bucket:"eu-eu", testName:"multi_currency_editor"}, + {step:1, bucket:"eu-usd", testName:"multi_currency_editor"} + + ] \ No newline at end of file diff --git a/services/web/public/coffee/analytics/AbTestingManager.coffee b/services/web/public/coffee/analytics/AbTestingManager.coffee index 88735315d1..01c8127195 100644 --- a/services/web/public/coffee/analytics/AbTestingManager.coffee +++ b/services/web/public/coffee/analytics/AbTestingManager.coffee @@ -35,7 +35,7 @@ define [ return false _getUsersHash = (testName)-> - sl_user_test_token = "sl_utt" + sl_user_test_token = "sl_utt_#{testName}" user_uuid = ipCookie(sl_user_test_token) if !user_uuid? user_uuid = Math.random() diff --git a/services/web/public/coffee/main/new-subscription.coffee b/services/web/public/coffee/main/new-subscription.coffee index f03b7e70c6..6d7d542817 100644 --- a/services/web/public/coffee/main/new-subscription.coffee +++ b/services/web/public/coffee/main/new-subscription.coffee @@ -2,11 +2,21 @@ define [ "base" ], (App)-> - App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing)-> - + App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing, abTestManager)-> $scope.currencyCode = MultiCurrencyPricing.currencyCode $scope.plans = MultiCurrencyPricing.plans + + if MultiCurrencyPricing.currencyCode != "USD" + currencyBuckets = [ + { bucketName:"eu-eu", currency:MultiCurrencyPricing.currencyCode} + { bucketName:"eu-usd", currency:"USD"} + ] + multiCurrencyBucket = abTestManager.getABTestBucket "multi_currency", currencyBuckets + $scope.currencyCode = multiCurrencyBucket.currency + abTestManager.processTestWithStep("multi_currency_editor", multiCurrencyBucket.bucketName, 0) + + $scope.changeCurrency = (newCurrency)-> window.location = "/user/subscription/new?planCode=#{window.plan_code}¤cy=#{newCurrency}" \ No newline at end of file diff --git a/services/web/public/coffee/main/plans.coffee b/services/web/public/coffee/main/plans.coffee index 5fa6844e1e..e8a014a43e 100644 --- a/services/web/public/coffee/main/plans.coffee +++ b/services/web/public/coffee/main/plans.coffee @@ -29,11 +29,11 @@ define [ monthly: "€7" annual: "€70" collaborator: - monthly: "€12" - annual: "€144" + monthly: "€14" + annual: "€168" professional: - monthly: "€25" - annual: "€300" + monthly: "€28" + annual: "€336" GBP: symbol: "£" @@ -41,11 +41,11 @@ define [ monthly: "£6" annual: "£60" collaborator: - monthly: "£10" - annual: "£120" + monthly: "£12" + annual: "£144" professional: - monthly: "£22" - annual: "£264" + monthly: "£24" + annual: "£288" } @@ -53,10 +53,25 @@ define [ App.controller "PlansController", ($scope, $modal, event_tracking, abTestManager, MultiCurrencyPricing, $http) -> + + $scope.plans = MultiCurrencyPricing.plans + $scope.currencyCode = MultiCurrencyPricing.currencyCode + + buckets = [ { bucketName:"7d", queryString: "_free_trial_7_days", trial_len:7 } { bucketName:"14d", queryString: "_free_trial_14_days", trial_len:14 } ] + + if MultiCurrencyPricing.currencyCode != "USD" + currencyBuckets = [ + { bucketName:"eu-eu", currency:MultiCurrencyPricing.currencyCode} + { bucketName:"eu-usd", currency:"USD"} + ] + multiCurrencyBucket = abTestManager.getABTestBucket "multi_currency", currencyBuckets + $scope.currencyCode = multiCurrencyBucket.currency + + bucket = abTestManager.getABTestBucket "trial_len", buckets $scope.trial_len = bucket.trial_len @@ -65,13 +80,15 @@ define [ $scope.ui = view: "monthly" - $scope.plans = MultiCurrencyPricing.plans - $scope.currencyCode = MultiCurrencyPricing.currencyCode + $scope.changeCurreny = (newCurrency)-> $scope.currencyCode = newCurrency $scope.signUpNowClicked = (plan, annual)-> + if multiCurrencyBucket? + abTestManager.processTestWithStep("multi_currency", multiCurrencyBucket.bucketName, 0) + if $scope.ui.view == "annual" plan = "#{plan}_annual" else