From dda4ce18d3b0e0081098c9345aad0dd832a14d0c Mon Sep 17 00:00:00 2001 From: nate stemen Date: Mon, 3 Feb 2020 09:11:36 -0500 Subject: [PATCH] Merge pull request #2556 from overleaf/cmg-missing-analytics Add missing Google Analytics events GitOrigin-RevId: 37f8ca52829ea00bd73b2cd1e0045c48839ea970 --- services/web/app/views/project/list/side-bar.pug | 4 ++-- services/web/app/views/subscriptions/dashboard.pug | 2 +- services/web/frontend/js/main.js | 1 + .../project-list/left-hand-menu-promo-controller.js | 11 ++++++++++- .../js/main/subscription/upgrade-subscription.js | 9 +++++++++ 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 services/web/frontend/js/main/subscription/upgrade-subscription.js diff --git a/services/web/app/views/project/list/side-bar.pug b/services/web/app/views/project/list/side-bar.pug index a27f4d4e8f..e24dddc2dc 100644 --- a/services/web/app/views/project/list/side-bar.pug +++ b/services/web/app/views/project/list/side-bar.pug @@ -161,10 +161,10 @@ hr p.small #{translate("on_free_sl")} p - a(href="/user/subscription/plans").btn.btn-primary #{translate("upgrade")} + a(href="/user/subscription/plans" ng-click="upgradeSubscription()").btn.btn-primary #{translate("upgrade")} p.small.text-centered | #{translate("or_unlock_features_bonus")} - a(href="/user/bonus") #{translate("sharing_sl")}. + a(href="/user/bonus" ng-click="share()") #{translate("sharing_sl")}. script. diff --git a/services/web/app/views/subscriptions/dashboard.pug b/services/web/app/views/subscriptions/dashboard.pug index 1d7b081a56..e0eb05e0d6 100644 --- a/services/web/app/views/subscriptions/dashboard.pug +++ b/services/web/app/views/subscriptions/dashboard.pug @@ -50,4 +50,4 @@ block content -else p(ng-non-bindable) You're on the #{settings.appName} Free plan. | - a(href="/user/subscription/plans").btn.btn-primary Upgrade now + a(ng-controller="UpgradeSubscriptionController" href="/user/subscription/plans" ng-click="upgradeSubscription()").btn.btn-primary Upgrade now diff --git a/services/web/frontend/js/main.js b/services/web/frontend/js/main.js index 29a31a4355..397b92214f 100644 --- a/services/web/frontend/js/main.js +++ b/services/web/frontend/js/main.js @@ -27,6 +27,7 @@ define([ 'main/annual-upgrade', 'main/register-users', 'main/subscription/team-invite-controller', + 'main/subscription/upgrade-subscription', 'main/contact-us', 'main/learn', 'main/exposed-settings', diff --git a/services/web/frontend/js/main/project-list/left-hand-menu-promo-controller.js b/services/web/frontend/js/main/project-list/left-hand-menu-promo-controller.js index d57ccc28be..63b367e1e5 100644 --- a/services/web/frontend/js/main/project-list/left-hand-menu-promo-controller.js +++ b/services/web/frontend/js/main/project-list/left-hand-menu-promo-controller.js @@ -1,11 +1,20 @@ define(['base'], App => App.controller('LeftHandMenuPromoController', function( $scope, - UserAffiliationsDataService + UserAffiliationsDataService, + eventTracking ) { $scope.hasProjects = window.data.projects.length > 0 $scope.userHasNoSubscription = window.userHasNoSubscription + $scope.upgradeSubscription = function() { + eventTracking.send('subscription-funnel', 'project-page', 'upgrade') + } + + $scope.share = function() { + eventTracking.send('subscription-funnel', 'project-page', 'sharing') + } + const _userHasNoAffiliation = function() { $scope.userEmails = [] $scope.userAffiliations = [] diff --git a/services/web/frontend/js/main/subscription/upgrade-subscription.js b/services/web/frontend/js/main/subscription/upgrade-subscription.js new file mode 100644 index 0000000000..ea2f261a7c --- /dev/null +++ b/services/web/frontend/js/main/subscription/upgrade-subscription.js @@ -0,0 +1,9 @@ +define(['base'], App => + App.controller('UpgradeSubscriptionController', function( + $scope, + eventTracking + ) { + $scope.upgradeSubscription = function() { + eventTracking.send('subscription-funnel', 'subscription-page', 'upgrade') + } + }))