From e5d453454ed16ae3c65b93fee001ad0a7c6f328d Mon Sep 17 00:00:00 2001 From: Jessica Lawshe Date: Wed, 27 Feb 2019 11:24:43 -0600 Subject: [PATCH] Merge pull request #1561 from sharelatex/jel-subscription-events Also send subscription events to Google Analytics GitOrigin-RevId: b1a078550c7c92863f3d8225aa78b9240faa2e72 --- services/web/public/src/main/new-subscription.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/web/public/src/main/new-subscription.js b/services/web/public/src/main/new-subscription.js index 10d994a7ab..3f67bc6ac3 100644 --- a/services/web/public/src/main/new-subscription.js +++ b/services/web/public/src/main/new-subscription.js @@ -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}¤cy=${ $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() {