From d8f54fc15a1783f8f03a42a8cd0d764ac409fad8 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 26 Apr 2017 10:32:14 -0400 Subject: [PATCH] telemetry for organizations --- .../organizationBillingAdjustSeatsController.js | 1 + .../organizationBillingChangePaymentController.js | 1 + src/app/organization/organizationBillingController.js | 4 +++- src/app/organization/organizationDashboardController.js | 2 -- src/app/organization/organizationPeopleController.js | 6 +++++- src/app/organization/organizationPeopleEditController.js | 6 +++++- src/app/organization/organizationPeopleInviteController.js | 6 +++++- src/app/organization/organizationSettingsController.js | 4 +++- src/app/organization/organizationSubvaultsAddController.js | 2 ++ src/app/organization/organizationSubvaultsController.js | 3 ++- src/app/organization/organizationSubvaultsEditController.js | 1 + .../organization/organizationSubvaultsGroupsController.js | 3 ++- .../organization/organizationSubvaultsUsersController.js | 2 ++ src/app/organization/organizationVaultController.js | 3 ++- 14 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/app/organization/organizationBillingAdjustSeatsController.js b/src/app/organization/organizationBillingAdjustSeatsController.js index 750558af15..8aa31d15c9 100644 --- a/src/app/organization/organizationBillingAdjustSeatsController.js +++ b/src/app/organization/organizationBillingAdjustSeatsController.js @@ -3,6 +3,7 @@ .controller('organizationBillingAdjustSeatsController', function ($scope, $state, $uibModalInstance, apiService, $analytics, toastr, add) { + $analytics.eventTrack('organizationBillingAdjustSeatsController', { category: 'Modal' }); $scope.add = add; $scope.seatAdjustment = 0; diff --git a/src/app/organization/organizationBillingChangePaymentController.js b/src/app/organization/organizationBillingChangePaymentController.js index 76dddfb222..dc82d5fbc0 100644 --- a/src/app/organization/organizationBillingChangePaymentController.js +++ b/src/app/organization/organizationBillingChangePaymentController.js @@ -3,6 +3,7 @@ .controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, stripe, $analytics, toastr, existingPaymentMethod) { + $analytics.eventTrack('organizationBillingChangePaymentController', { category: 'Modal' }); $scope.existingPaymentMethod = existingPaymentMethod; $scope.submit = function () { diff --git a/src/app/organization/organizationBillingController.js b/src/app/organization/organizationBillingController.js index 3c05c5c751..6703e8e807 100644 --- a/src/app/organization/organizationBillingController.js +++ b/src/app/organization/organizationBillingController.js @@ -1,7 +1,7 @@ angular .module('bit.organization') - .controller('organizationBillingController', function ($scope, apiService, $state, $uibModal, toastr) { + .controller('organizationBillingController', function ($scope, apiService, $state, $uibModal, toastr, $analytics) { $scope.charges = []; $scope.paymentSource = null; $scope.plan = null; @@ -71,6 +71,7 @@ apiService.organizations.putCancel({ id: $state.params.orgId }, {}) .$promise.then(function (response) { + $analytics.eventTrack('Canceled Plan'); toastr.success('Organization subscription has been canceled.'); load(); }); @@ -83,6 +84,7 @@ apiService.organizations.putReinstate({ id: $state.params.orgId }, {}) .$promise.then(function (response) { + $analytics.eventTrack('Reinstated Plan'); toastr.success('Organization cancellation request has been removed.'); load(); }); diff --git a/src/app/organization/organizationDashboardController.js b/src/app/organization/organizationDashboardController.js index 0e0546a2b8..c230858b39 100644 --- a/src/app/organization/organizationDashboardController.js +++ b/src/app/organization/organizationDashboardController.js @@ -7,8 +7,6 @@ if (!userProfile.organizations) { return; } - - $scope.orgProfile = userProfile.organizations[$state.params.orgId]; }); }); diff --git a/src/app/organization/organizationPeopleController.js b/src/app/organization/organizationPeopleController.js index f06038142b..f4f819e009 100644 --- a/src/app/organization/organizationPeopleController.js +++ b/src/app/organization/organizationPeopleController.js @@ -1,7 +1,8 @@ angular .module('bit.organization') - .controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService, toastr) { + .controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService, + toastr, $analytics) { $scope.users = []; $scope.$on('$viewContentLoaded', function () { loadList(); @@ -9,6 +10,7 @@ $scope.reinvite = function (user) { apiService.organizationUsers.reinvite({ orgId: $state.params.orgId, id: user.id }, null, function () { + $analytics.eventTrack('Reinvited User'); toastr.success(user.email + ' has been invited again.', 'User Invited'); }, function () { toastr.error('Unable to invite user.', 'Error'); @@ -21,6 +23,7 @@ } apiService.organizationUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () { + $analytics.eventTrack('Deleted User'); toastr.success(user.email + ' has been removed.', 'User Removed'); var index = $scope.users.indexOf(user); if (index > -1) { @@ -42,6 +45,7 @@ var key = cryptoService.rsaEncrypt(orgKey.key, userKey.PublicKey); apiService.organizationUsers.confirm({ orgId: $state.params.orgId, id: user.id }, { key: key }, function () { user.status = 2; + $analytics.eventTrack('Confirmed User'); toastr.success(user.email + ' has been confirmed.', 'User Confirmed'); }, function () { toastr.error('Unable to confirm user.', 'Error'); diff --git a/src/app/organization/organizationPeopleEditController.js b/src/app/organization/organizationPeopleEditController.js index 72c1e1c2b9..af812c59fc 100644 --- a/src/app/organization/organizationPeopleEditController.js +++ b/src/app/organization/organizationPeopleEditController.js @@ -1,7 +1,10 @@ angular .module('bit.organization') - .controller('organizationPeopleEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService, id) { + .controller('organizationPeopleEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService, id, + $analytics) { + $analytics.eventTrack('organizationPeopleEditController', { category: 'Modal' }); + $scope.loading = true; $scope.subvaults = []; $scope.selectedSubvaults = {}; @@ -86,6 +89,7 @@ subvaults: subvaults, accessAllSubvaults: $scope.accessAllSubvaults }, function () { + $analytics.eventTrack('Edited User'); $uibModalInstance.close(); }).$promise; }; diff --git a/src/app/organization/organizationPeopleInviteController.js b/src/app/organization/organizationPeopleInviteController.js index 4915051d60..2d1aff4685 100644 --- a/src/app/organization/organizationPeopleInviteController.js +++ b/src/app/organization/organizationPeopleInviteController.js @@ -1,7 +1,10 @@ angular .module('bit.organization') - .controller('organizationPeopleInviteController', function ($scope, $state, $uibModalInstance, apiService, cipherService) { + .controller('organizationPeopleInviteController', function ($scope, $state, $uibModalInstance, apiService, cipherService, + $analytics) { + $analytics.eventTrack('organizationPeopleInviteController', { category: 'Modal' }); + $scope.loading = true; $scope.subvaults = []; $scope.selectedSubvaults = {}; @@ -75,6 +78,7 @@ subvaults: subvaults, accessAllSubvaults: model.accessAllSubvaults }, function () { + $analytics.eventTrack('Invited User'); $uibModalInstance.close(); }).$promise; }; diff --git a/src/app/organization/organizationSettingsController.js b/src/app/organization/organizationSettingsController.js index 32e8604098..7419a18e24 100644 --- a/src/app/organization/organizationSettingsController.js +++ b/src/app/organization/organizationSettingsController.js @@ -1,7 +1,8 @@ angular .module('bit.organization') - .controller('organizationSettingsController', function ($scope, $state, apiService, toastr, authService, $uibModal) { + .controller('organizationSettingsController', function ($scope, $state, apiService, toastr, authService, $uibModal, + $analytics) { $scope.model = {}; $scope.$on('$viewContentLoaded', function () { apiService.organizations.get({ id: $state.params.orgId }, function (org) { @@ -16,6 +17,7 @@ $scope.generalSave = function () { $scope.generalPromise = apiService.organizations.put({ id: $state.params.orgId }, $scope.model, function (org) { authService.updateProfileOrganization(org).then(function (updatedOrg) { + $analytics.eventTrack('Updated Organization Settings'); toastr.success('Organization has been updated.', 'Success!'); }); }).$promise; diff --git a/src/app/organization/organizationSubvaultsAddController.js b/src/app/organization/organizationSubvaultsAddController.js index f1255d2135..256d84ce46 100644 --- a/src/app/organization/organizationSubvaultsAddController.js +++ b/src/app/organization/organizationSubvaultsAddController.js @@ -3,6 +3,8 @@ .controller('organizationSubvaultsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService, $analytics) { + $analytics.eventTrack('organizationSubvaultsAddController', { category: 'Modal' }); + $scope.submit = function (model) { var subvault = cipherService.encryptSubvault(model, $state.params.orgId); $scope.submitPromise = apiService.subvaults.post({ orgId: $state.params.orgId }, subvault, function (response) { diff --git a/src/app/organization/organizationSubvaultsController.js b/src/app/organization/organizationSubvaultsController.js index f3af395b5f..072b47fe2f 100644 --- a/src/app/organization/organizationSubvaultsController.js +++ b/src/app/organization/organizationSubvaultsController.js @@ -2,7 +2,7 @@ .module('bit.organization') .controller('organizationSubvaultsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter, - toastr) { + toastr, $analytics) { $scope.subvaults = []; $scope.loading = true; $scope.$on('$viewContentLoaded', function () { @@ -81,6 +81,7 @@ $scope.subvaults.splice(index, 1); } + $analytics.eventTrack('Deleted Subvault'); toastr.success(subvault.name + ' has been deleted.', 'Subvault Deleted'); }, function () { toastr.error(subvault.name + ' was not able to be deleted.', 'Error'); diff --git a/src/app/organization/organizationSubvaultsEditController.js b/src/app/organization/organizationSubvaultsEditController.js index 383cc33f47..ed5a7f2443 100644 --- a/src/app/organization/organizationSubvaultsEditController.js +++ b/src/app/organization/organizationSubvaultsEditController.js @@ -3,6 +3,7 @@ .controller('organizationSubvaultsEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService, $analytics, id) { + $analytics.eventTrack('organizationSubvaultsEditController', { category: 'Modal' }); $scope.subvault = {}; $uibModalInstance.opened.then(function () { diff --git a/src/app/organization/organizationSubvaultsGroupsController.js b/src/app/organization/organizationSubvaultsGroupsController.js index e0802b9285..0016d23624 100644 --- a/src/app/organization/organizationSubvaultsGroupsController.js +++ b/src/app/organization/organizationSubvaultsGroupsController.js @@ -1,7 +1,8 @@ angular .module('bit.organization') - .controller('organizationSubvaultsGroupsController', function ($scope, $state, $uibModalInstance, subvault) { + .controller('organizationSubvaultsGroupsController', function ($scope, $state, $uibModalInstance, subvault, $analytics) { + $analytics.eventTrack('organizationSubvaultsGroupsController', { category: 'Modal' }); $scope.subvault = subvault; $scope.close = function () { diff --git a/src/app/organization/organizationSubvaultsUsersController.js b/src/app/organization/organizationSubvaultsUsersController.js index 7a0696e539..38bcda19c8 100644 --- a/src/app/organization/organizationSubvaultsUsersController.js +++ b/src/app/organization/organizationSubvaultsUsersController.js @@ -3,6 +3,7 @@ .controller('organizationSubvaultsUsersController', function ($scope, $state, $uibModalInstance, apiService, cipherService, $analytics, subvault, toastr) { + $analytics.eventTrack('organizationSubvaultsUsersController', { category: 'Modal' }); $scope.loading = true; $scope.subvault = subvault; $scope.users = []; @@ -42,6 +43,7 @@ apiService.subvaultUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () { toastr.success(user.email + ' has been removed.', 'User Removed'); + $analytics.eventTrack('Removed User From Subvault'); var index = $scope.users.indexOf(user); if (index > -1) { $scope.users.splice(index, 1); diff --git a/src/app/organization/organizationVaultController.js b/src/app/organization/organizationVaultController.js index 7948e8cfc4..1b3b251344 100644 --- a/src/app/organization/organizationVaultController.js +++ b/src/app/organization/organizationVaultController.js @@ -112,7 +112,7 @@ } apiService.ciphers.putSubvaults({ id: login.id }, request).$promise.then(function (response) { - $analytics.eventTrack('Removed From Subvault'); + $analytics.eventTrack('Removed Login From Subvault'); login.subvaultIds = request.subvaultIds; }); }; @@ -123,6 +123,7 @@ } apiService.ciphers.delAdmin({ id: login.id }, function () { + $analytics.eventTrack('Deleted Login'); var index = $scope.logins.indexOf(login); if (index > -1) { $scope.logins.splice(index, 1);