Merge pull request #4084 from overleaf/ab-subscription-flow-events

Subscription flow analytics events

GitOrigin-RevId: c74121031ba8623244657c607a76a513380e96f5
This commit is contained in:
Alexandre Bourdin 2021-05-26 14:32:12 +02:00 committed by Copybot
parent 18d62dcee9
commit 551e2bfb5c
2 changed files with 11 additions and 6 deletions

View file

@ -73,6 +73,7 @@ block content
form( form(
name="simpleCCForm" name="simpleCCForm"
novalidate novalidate
ng-keypress="filledForm()"
) )
div.payment-method-toggle div.payment-method-toggle

View file

@ -34,7 +34,7 @@ export default App.controller(
$scope.switchToStudent = function () { $scope.switchToStudent = function () {
const currentPlanCode = window.plan_code const currentPlanCode = window.plan_code
const planCode = currentPlanCode.replace('collaborator', 'student') const planCode = currentPlanCode.replace('collaborator', 'student')
eventTracking.sendMB('subscription-form-switch-to-student', { eventTracking.sendMB('payment-page-switch-to-student', {
plan: window.plan_code, plan: window.plan_code,
}) })
eventTracking.send( eventTracking.send(
@ -45,7 +45,7 @@ export default App.controller(
window.location = `/user/subscription/new?planCode=${planCode}&currency=${$scope.currencyCode}&cc=${$scope.data.coupon}&itm_campaign=${window.ITMCampaign}&itm_content=${window.ITMContent}` window.location = `/user/subscription/new?planCode=${planCode}&currency=${$scope.currencyCode}&cc=${$scope.data.coupon}&itm_campaign=${window.ITMCampaign}&itm_content=${window.ITMContent}`
} }
eventTracking.sendMB('subscription-form', { plan: window.plan_code }) eventTracking.sendMB('payment-page-view', { plan: window.plan_code })
eventTracking.send( eventTracking.send(
'subscription-funnel', 'subscription-funnel',
'subscription-form-viewed', 'subscription-form-viewed',
@ -211,7 +211,7 @@ export default App.controller(
} }
$scope.validation.errorFields = {} $scope.validation.errorFields = {}
if (err != null) { if (err != null) {
eventTracking.sendMB('subscription-error', err) eventTracking.sendMB('payment-page-form-error', err)
eventTracking.send('subscription-funnel', 'subscription-error') eventTracking.send('subscription-funnel', 'subscription-error')
// We may or may not be in a digest loop here depending on // We may or may not be in a digest loop here depending on
// whether recurly could do validation locally, so do it async // whether recurly could do validation locally, so do it async
@ -263,7 +263,7 @@ export default App.controller(
} }
} }
eventTracking.sendMB('subscription-form-submitted', { eventTracking.sendMB('payment-page-form-submit', {
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,
@ -277,7 +277,7 @@ export default App.controller(
return $http return $http
.post('/user/subscription/create', postData) .post('/user/subscription/create', postData)
.then(function () { .then(function () {
eventTracking.sendMB('subscription-submission-success') eventTracking.sendMB('payment-page-form-success')
eventTracking.send( eventTracking.send(
'subscription-funnel', 'subscription-funnel',
'subscription-submission-success', 'subscription-submission-success',
@ -629,5 +629,9 @@ export default App.controller(
{ code: 'ZM', name: 'Zambia' }, { code: 'ZM', name: 'Zambia' },
{ code: 'ZW', name: 'Zimbabwe' }, { code: 'ZW', name: 'Zimbabwe' },
] ]
$scope.filledForm = function () {
eventTracking.sendMBOnce('payment-page-form-fill')
}
} }
) )