Merge pull request #1561 from sharelatex/jel-subscription-events

Also send subscription events to Google Analytics

GitOrigin-RevId: b1a078550c7c92863f3d8225aa78b9240faa2e72
This commit is contained in:
Jessica Lawshe 2019-02-27 11:24:43 -06:00 committed by James Allen
parent 46c6d11574
commit e5d453454e

View file

@ -27,12 +27,14 @@ define(['base', 'directives/creditCards', 'libs/recurly-4.8.5'], App =>
event_tracking.sendMB('subscription-form-switch-to-student', {
plan: window.plan_code
})
event_tracking.send('subscription-funnel', 'subscription-form-switch-to-student', window.plan_code)
window.location = `/user/subscription/new?planCode=${planCode}&currency=${
$scope.currencyCode
}&cc=${$scope.data.coupon}`
}
event_tracking.sendMB('subscription-form', { plan: window.plan_code })
event_tracking.send('subscription-funnel', 'subscription-form-viewed', window.plan_code)
$scope.paymentMethod = { value: 'credit_card' }
@ -164,6 +166,7 @@ define(['base', 'directives/creditCards', 'libs/recurly-4.8.5'], App =>
$scope.validation.errorFields = {}
if (err != null) {
event_tracking.sendMB('subscription-error', err)
event_tracking.send('subscription-funnel', 'subscription-error')
// We may or may not be in a digest loop here depending on
// whether recurly could do validation locally, so do it async
$scope.$evalAsync(function() {
@ -200,11 +203,13 @@ define(['base', 'directives/creditCards', 'libs/recurly-4.8.5'], App =>
coupon_code: postData.subscriptionDetails.coupon_code,
isPaypal: postData.subscriptionDetails.isPaypal
})
event_tracking.send('subscription-funnel', 'subscription-form-submitted', postData.subscriptionDetails.plan_code)
return $http
.post('/user/subscription/create', postData)
.then(function() {
event_tracking.sendMB('subscription-submission-success')
event_tracking.send('subscription-funnel', 'subscription-submission-success', postData.subscriptionDetails.plan_code)
window.location.href = '/user/subscription/thank-you'
})
.catch(function() {