mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Handle sixpack timeouts and include variant in metabase segmentation
Render default when sixpack timesout Only convert when variant exists Use Angular cookies module to add variant cookie, which is used on the new subscription page.
This commit is contained in:
parent
356e31caec
commit
5b5ece37a5
3 changed files with 17 additions and 13 deletions
|
@ -14,5 +14,5 @@ block content
|
|||
.content.plans(ng-controller="PlansController")
|
||||
.container(class="more-details" ng-cloak ng-if="plansVariant === 'more-details'")
|
||||
include _plans_page_details_more
|
||||
.container(ng-cloak ng-if="plansVariant === 'default' || !shouldABTestPlans")
|
||||
.container(ng-cloak ng-if="plansVariant === 'default' || !shouldABTestPlans || timeout")
|
||||
include _plans_page_details_less
|
||||
|
|
|
@ -4,20 +4,21 @@ define [
|
|||
"libs/recurly-4.8.5"
|
||||
], (App)->
|
||||
|
||||
App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing, abTestManager, $http, sixpack, event_tracking, ccUtils)->
|
||||
App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing, abTestManager, $http, sixpack, event_tracking, ccUtils, ipCookie)->
|
||||
throw new Error("Recurly API Library Missing.") if typeof recurly is "undefined"
|
||||
|
||||
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
||||
$scope.plans = MultiCurrencyPricing.plans
|
||||
$scope.planCode = window.plan_code
|
||||
$scope.plansVariant = ipCookie('plansVariant')
|
||||
|
||||
$scope.switchToStudent = ()->
|
||||
currentPlanCode = window.plan_code
|
||||
planCode = currentPlanCode.replace('collaborator', 'student')
|
||||
event_tracking.sendMB 'subscription-form-switch-to-student', { plan: window.plan_code }
|
||||
event_tracking.sendMB 'subscription-form-switch-to-student', { plan: window.plan_code, variant: $scope.plansVariant }
|
||||
window.location = "/user/subscription/new?planCode=#{planCode}¤cy=#{$scope.currencyCode}&cc=#{$scope.data.coupon}"
|
||||
|
||||
event_tracking.sendMB "subscription-form", { plan : window.plan_code }
|
||||
event_tracking.sendMB "subscription-form", { plan : window.plan_code, variant: $scope.plansVariant }
|
||||
|
||||
$scope.paymentMethod =
|
||||
value: "credit_card"
|
||||
|
@ -143,13 +144,14 @@ define [
|
|||
currencyCode : postData.subscriptionDetails.currencyCode,
|
||||
plan_code : postData.subscriptionDetails.plan_code,
|
||||
coupon_code : postData.subscriptionDetails.coupon_code,
|
||||
isPaypal : postData.subscriptionDetails.isPaypal
|
||||
isPaypal : postData.subscriptionDetails.isPaypal,
|
||||
variant : $scope.plansVariant
|
||||
}
|
||||
|
||||
|
||||
$http.post("/user/subscription/create", postData)
|
||||
.then ()->
|
||||
event_tracking.sendMB "subscription-submission-success"
|
||||
event_tracking.sendMB "subscription-submission-success", { variant: $scope.plansVariant }
|
||||
window.location.href = "/user/subscription/thank-you"
|
||||
.catch ()->
|
||||
$scope.processing = false
|
||||
|
@ -234,7 +236,4 @@ define [
|
|||
{code:'VU',name:'Vanuatu'},{code:'VA',name:'Vatican City'},{code:'VE',name:'Venezuela'},{code:'VN',name:'Vietnam'},
|
||||
{code:'WK',name:'Wake Island'},{code:'WF',name:'Wallis and Futuna'},{code:'EH',name:'Western Sahara'},{code:'YE',name:'Yemen'},
|
||||
{code:'ZM',name:'Zambia'},{code:'AX',name:'Åland Islandscode:'}
|
||||
]
|
||||
|
||||
sixpack.participate 'plans', ['default', 'more-details'], (chosenVariation, rawResponse)->
|
||||
$scope.plansVariant = chosenVariation
|
||||
]
|
|
@ -145,7 +145,7 @@ define [
|
|||
}
|
||||
|
||||
|
||||
App.controller "PlansController", ($scope, $modal, event_tracking, abTestManager, MultiCurrencyPricing, $http, sixpack, $filter) ->
|
||||
App.controller "PlansController", ($scope, $modal, event_tracking, abTestManager, MultiCurrencyPricing, $http, sixpack, $filter, ipCookie) ->
|
||||
|
||||
$scope.showPlans = false
|
||||
$scope.shouldABTestPlans = window.shouldABTestPlans
|
||||
|
@ -154,7 +154,12 @@ define [
|
|||
sixpack.participate 'plans-details', ['default', 'more-details'], (chosenVariation, rawResponse)->
|
||||
if rawResponse?.status != 'failed'
|
||||
$scope.plansVariant = chosenVariation
|
||||
expiration = new Date();
|
||||
expiration.setDate(expiration.getDate() + 5);
|
||||
ipCookie('plansVariant', chosenVariation, {expires: expiration})
|
||||
event_tracking.send 'subscription-funnel', 'plans-page-loaded', chosenVariation
|
||||
else
|
||||
$scope.timeout = true
|
||||
|
||||
$scope.showPlans = true
|
||||
|
||||
|
@ -185,9 +190,9 @@ define [
|
|||
if $scope.ui.view == "annual"
|
||||
plan = "#{plan}_annual"
|
||||
plan = eventLabel(plan, location)
|
||||
event_tracking.sendMB 'plans-page-start-trial', {plan}
|
||||
event_tracking.sendMB 'plans-page-start-trial', {plan, variant: $scope.plansVariant}
|
||||
event_tracking.send 'subscription-funnel', 'sign_up_now_button', plan
|
||||
if $scope.shouldABTestPlans
|
||||
if $scope.plansVariant
|
||||
sixpack.convert 'plans-details'
|
||||
|
||||
$scope.switchToMonthly = (e, location) ->
|
||||
|
|
Loading…
Reference in a new issue