broken free trial func into own file. added ab test on upgrade button colour

This commit is contained in:
Henry Oswald 2014-11-24 23:59:55 +00:00
parent 6c0f03e9c7
commit 02ef07dca4
9 changed files with 44 additions and 22 deletions

View file

@ -25,8 +25,8 @@ script(type="text/ng-template", id="dropboxModalTemplate")
strong Dropbox/sharelatex/{{ project.name }}
div.text-center(ng-hide="dbState.hasDropboxFeature")
p #{translate("need_to_upgrade_for_dropbox")}
p
a.btn.btn-info(ng-click="startFreeTrial('dropbox')") #{translate("start_free_trial")}
p(ng-controller="FreeTrialModalController")
a.btn(ng-click="startFreeTrial('dropbox')", ng-class="buttonClass") #{translate("start_free_trial")}
p.small(ng-show="startedFreeTrial")
| #{translate("refresh_page_after_starting_free_trial")}

View file

@ -99,7 +99,7 @@ div.full-size.pdf(ng-controller="PdfController")
p
a.btn.btn-info(
href
ng-click="startFreeTrial('compile-timeout')"
ng-click="hello('compile-timeout')"
) #{translate("start_free_trial")}

View file

@ -68,8 +68,8 @@ script(type='text/ng-template', id='shareProjectModalTemplate')
) #{translate("share")}
div.text-center(ng-hide="canAddCollaborators")
p #{translate("need_to_upgrade_for_more_collabs")}.
p
a.btn.btn-info(href, ng-click="startFreeTrial('projectMembers')") #{translate("start_free_trial")}
p(ng-controller="FreeTrialModalController")
a.btn(href, ng-click="startFreeTrial('projectMembers')", ng-class="buttonClass") #{translate("start_free_trial")}
p.small(ng-show="startedFreeTrial")
| #{translate("refresh_page_after_starting_free_trial")}.

View file

@ -2,9 +2,10 @@ div#trackChanges(ng-show="ui.view == 'track-changes'")
.upgrade-prompt(ng-show="!project.features.versioning")
.message(ng-show="project.owner._id == user.id")
p #{translate("need_to_upgrade_for_history")}
p
a.btn.btn-info(
p(ng-controller="FreeTrialModalController")
a.btn(
href
ng-class="buttonClass"
ng-click="startFreeTrial('track-changes')"
) #{translate("start_free_trial")}
p.small(ng-show="startedFreeTrial") #{translate("refresh_page_after_starting_free_trial")}

View file

@ -86,7 +86,7 @@ block content
Recurly.buildSubscriptionForm(recurlySubscriptionFormConfig);
window.ab = [
{step:1, bucket:"eu-eu", testName:"multi_currency"},
{step:1, bucket:"eu-usd", testName:"multi_currency"}
{step:1, bucket:"red", testName:"button_color"},
{step:1, bucket:"blue", testName:"button_color"}
]

View file

@ -37,4 +37,7 @@ block content
window.ab = [
{step:1, bucket:"student_control", testName:"editor_plan"},
{step:1, bucket:"collab_test", testName:"editor_plan"},
{step:2, bucket:"blue", testName:"button_color"},
{step:2, bucket:"red", testName:"button_color"}
]

View file

@ -28,7 +28,7 @@ script(type="text/ng-template", id="BonusLinkToUsModal")
div.text-center(ng-hide="dbState.hasDropboxFeature")
p You need to upgrade your account to link to dropbox.
p
a.btn.btn-info(ng-click="startFreeTrial('dropbox')") Start Free Trial
a.btn(ng-click="startFreeTrial('dropbox')", ng-class="buttonClass") Start Free Trial
p.small(ng-show="startedFreeTrial")
| Please refresh this page after starting your free trial.

View file

@ -27,6 +27,7 @@ define [
"directives/rightClick"
"filters/formatDate"
"main/event-tracking"
"main/account-upgrade"
], (
App
FileTreeManager
@ -38,7 +39,8 @@ define [
PdfManager
BinaryFilesManager
) ->
App.controller "IdeController", ($scope, $timeout, ide, abTestManager) ->
App.controller "IdeController", ($scope, $timeout, ide) ->
# Don't freak out if we're already in an apply callback
$scope.$originalApply = $scope.$apply
$scope.$apply = (fn = () ->) ->
@ -64,17 +66,6 @@ define [
$scope.chat = {}
$scope.startFreeTrial = (source) ->
testBuckets = [
{ bucketName:"student_control", planName:"student"}
{ bucketName:"collab_test", planName:"collaborator"}
]
editorPlanBucket = abTestManager.getABTestBucket "editor_plan", testBuckets
abTestManager.processTestWithStep("editor_plan", editorPlanBucket.bucketName, 0)
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
window.open("/user/subscription/new?planCode=#{editorPlanBucket.planName}_free_trial_7_days&ssp=#{editorPlanBucket.planName == 'collaborator'}")
$scope.startedFreeTrial = true
window._ide = ide

View file

@ -0,0 +1,27 @@
define [
"base"
], (App) ->
App.controller "FreeTrialModalController", ($scope, abTestManager)->
buttonColorBuckets = [
{ bucketName:"red", btnClass:"primary"}
{ bucketName:"blue", btnClass:"info"}
]
buttonColorBucket = abTestManager.getABTestBucket "button_color", buttonColorBuckets
abTestManager.processTestWithStep("button_color", buttonColorBucket.bucketName, 0)
$scope.buttonClass = "btn-#{buttonColorBucket.btnClass}"
$scope.startFreeTrial = (source) ->
testBuckets = [
{ bucketName:"student_control", planName:"student"}
{ bucketName:"collab_test", planName:"collaborator"}
]
editorPlanBucket = abTestManager.getABTestBucket "editor_plan", testBuckets
abTestManager.processTestWithStep("editor_plan", editorPlanBucket.bucketName, 0)
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
window.open("/user/subscription/new?planCode=#{editorPlanBucket.planName}_free_trial_7_days&ssp=#{editorPlanBucket.planName == 'collaborator'}")
$scope.startedFreeTrial = true