mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #820 from sharelatex/jel-plans-variant
Plans and Pricing Analytics
This commit is contained in:
commit
b98abd1787
3 changed files with 20 additions and 15 deletions
|
@ -14,5 +14,5 @@ block content
|
||||||
.content.plans(ng-controller="PlansController")
|
.content.plans(ng-controller="PlansController")
|
||||||
.container(class="more-details" ng-cloak ng-if="plansVariant === 'more-details'")
|
.container(class="more-details" ng-cloak ng-if="plansVariant === 'more-details'")
|
||||||
include _plans_page_details_more
|
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
|
include _plans_page_details_less
|
||||||
|
|
|
@ -4,20 +4,21 @@ define [
|
||||||
"libs/recurly-4.8.5"
|
"libs/recurly-4.8.5"
|
||||||
], (App)->
|
], (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"
|
throw new Error("Recurly API Library Missing.") if typeof recurly is "undefined"
|
||||||
|
|
||||||
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
||||||
$scope.plans = MultiCurrencyPricing.plans
|
$scope.plans = MultiCurrencyPricing.plans
|
||||||
$scope.planCode = window.plan_code
|
$scope.planCode = window.plan_code
|
||||||
|
$scope.plansVariant = ipCookie('plansVariant')
|
||||||
|
|
||||||
$scope.switchToStudent = ()->
|
$scope.switchToStudent = ()->
|
||||||
currentPlanCode = window.plan_code
|
currentPlanCode = window.plan_code
|
||||||
planCode = currentPlanCode.replace('collaborator', 'student')
|
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}"
|
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 =
|
$scope.paymentMethod =
|
||||||
value: "credit_card"
|
value: "credit_card"
|
||||||
|
@ -143,13 +144,14 @@ define [
|
||||||
currencyCode : postData.subscriptionDetails.currencyCode,
|
currencyCode : postData.subscriptionDetails.currencyCode,
|
||||||
plan_code : postData.subscriptionDetails.plan_code,
|
plan_code : postData.subscriptionDetails.plan_code,
|
||||||
coupon_code : postData.subscriptionDetails.coupon_code,
|
coupon_code : postData.subscriptionDetails.coupon_code,
|
||||||
isPaypal : postData.subscriptionDetails.isPaypal
|
isPaypal : postData.subscriptionDetails.isPaypal,
|
||||||
|
variant : $scope.plansVariant
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$http.post("/user/subscription/create", postData)
|
$http.post("/user/subscription/create", postData)
|
||||||
.then ()->
|
.then ()->
|
||||||
event_tracking.sendMB "subscription-submission-success"
|
event_tracking.sendMB "subscription-submission-success", { variant: $scope.plansVariant }
|
||||||
window.location.href = "/user/subscription/thank-you"
|
window.location.href = "/user/subscription/thank-you"
|
||||||
.catch ()->
|
.catch ()->
|
||||||
$scope.processing = false
|
$scope.processing = false
|
||||||
|
@ -235,6 +237,3 @@ define [
|
||||||
{code:'WK',name:'Wake Island'},{code:'WF',name:'Wallis and Futuna'},{code:'EH',name:'Western Sahara'},{code:'YE',name:'Yemen'},
|
{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:'}
|
{code:'ZM',name:'Zambia'},{code:'AX',name:'Åland Islandscode:'}
|
||||||
]
|
]
|
||||||
|
|
||||||
sixpack.participate 'plans', ['default', 'more-details'], (chosenVariation, rawResponse)->
|
|
||||||
$scope.plansVariant = chosenVariation
|
|
|
@ -145,15 +145,21 @@ 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.showPlans = false
|
||||||
$scope.shouldABTestPlans = window.shouldABTestPlans
|
$scope.shouldABTestPlans = window.shouldABTestPlans
|
||||||
|
|
||||||
if $scope.shouldABTestPlans
|
if $scope.shouldABTestPlans
|
||||||
sixpack.participate 'plans-details', ['default', 'more-details'], (chosenVariation, rawResponse)->
|
sixpack.participate 'plans-details', ['default', 'more-details'], (chosenVariation, rawResponse)->
|
||||||
|
if rawResponse?.status != 'failed'
|
||||||
$scope.plansVariant = chosenVariation
|
$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
|
event_tracking.send 'subscription-funnel', 'plans-page-loaded', chosenVariation
|
||||||
|
else
|
||||||
|
$scope.timeout = true
|
||||||
|
|
||||||
$scope.showPlans = true
|
$scope.showPlans = true
|
||||||
|
|
||||||
|
@ -184,9 +190,9 @@ define [
|
||||||
if $scope.ui.view == "annual"
|
if $scope.ui.view == "annual"
|
||||||
plan = "#{plan}_annual"
|
plan = "#{plan}_annual"
|
||||||
plan = eventLabel(plan, location)
|
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
|
event_tracking.send 'subscription-funnel', 'sign_up_now_button', plan
|
||||||
if $scope.shouldABTestPlans
|
if $scope.plansVariant
|
||||||
sixpack.convert 'plans-details'
|
sixpack.convert 'plans-details'
|
||||||
|
|
||||||
$scope.switchToMonthly = (e, location) ->
|
$scope.switchToMonthly = (e, location) ->
|
||||||
|
|
Loading…
Reference in a new issue