1
0
mirror of https://github.com/bitwarden/web synced 2025-12-06 00:03:28 +00:00

telemetry events

This commit is contained in:
Kyle Spearrin
2017-04-26 10:21:06 -04:00
parent b0d2374960
commit 90b0f3201e
12 changed files with 35 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
angular angular
.module('bit.accounts') .module('bit.accounts')
.controller('accountsOrganizationAcceptController', function ($scope, $state, apiService, authService, toastr) { .controller('accountsOrganizationAcceptController', function ($scope, $state, apiService, authService, toastr, $analytics) {
$scope.state = { $scope.state = {
name: $state.current.name, name: $state.current.name,
params: $state.params params: $state.params
@@ -26,11 +26,13 @@ angular
{ {
token: $state.params.token token: $state.params.token
}, function () { }, function () {
$analytics.eventTrack('Accepted Invitation');
$state.go('backend.user.vault', null, { location: 'replace' }).then(function () { $state.go('backend.user.vault', null, { location: 'replace' }).then(function () {
toastr.success('You can access this organization once an administrator confirms your membership.' + toastr.success('You can access this organization once an administrator confirms your membership.' +
' We\'ll send an email when that happens.', 'Invite Accepted', { timeOut: 10000 }); ' We\'ll send an email when that happens.', 'Invite Accepted', { timeOut: 10000 });
}); });
}, function () { }, function () {
$analytics.eventTrack('Failed To Accept Invitation');
$state.go('backend.user.vault', null, { location: 'replace' }).then(function () { $state.go('backend.user.vault', null, { location: 'replace' }).then(function () {
toastr.error('Unable to accept invitation.', 'Error'); toastr.error('Unable to accept invitation.', 'Error');
}); });

View File

@@ -1,11 +1,12 @@
angular angular
.module('bit.accounts') .module('bit.accounts')
.controller('accountsPasswordHintController', function ($scope, $rootScope, apiService) { .controller('accountsPasswordHintController', function ($scope, $rootScope, apiService, $analytics) {
$scope.success = false; $scope.success = false;
$scope.submit = function (model) { $scope.submit = function (model) {
$scope.submitPromise = apiService.accounts.postPasswordHint({ email: model.email }, function () { $scope.submitPromise = apiService.accounts.postPasswordHint({ email: model.email }, function () {
$analytics.eventTrack('Requested Password Hint');
$scope.success = true; $scope.success = true;
}).$promise; }).$promise;
}; };

View File

@@ -1,7 +1,7 @@
angular angular
.module('bit.accounts') .module('bit.accounts')
.controller('accountsRecoverController', function ($scope, apiService, cryptoService) { .controller('accountsRecoverController', function ($scope, apiService, cryptoService, $analytics) {
$scope.success = false; $scope.success = false;
$scope.submit = function (model) { $scope.submit = function (model) {
@@ -15,6 +15,7 @@ angular
}; };
$scope.submitPromise = apiService.accounts.postTwoFactorRecover(request, function () { $scope.submitPromise = apiService.accounts.postTwoFactorRecover(request, function () {
$analytics.eventTrack('Recovered 2FA');
$scope.success = true; $scope.success = true;
}).$promise; }).$promise;
}; };

View File

@@ -1,7 +1,7 @@
angular angular
.module('bit.global') .module('bit.global')
.controller('sideNavController', function ($scope, $state, authService, toastr) { .controller('sideNavController', function ($scope, $state, authService, toastr, $analytics) {
$scope.$state = $state; $scope.$state = $state;
$scope.params = $state.params; $scope.params = $state.params;
$scope.orgs = []; $scope.orgs = [];
@@ -36,6 +36,7 @@ angular
return; return;
} }
$analytics.eventTrack('View Organization From Side Nav');
$state.go('backend.org.dashboard', { orgId: org.id }); $state.go('backend.org.dashboard', { orgId: org.id });
}; };

View File

@@ -1,7 +1,8 @@
angular angular
.module('bit.vault') .module('bit.vault')
.controller('settingsAddEditEquivalentDomainController', function ($scope, $uibModalInstance, $analytics, domainIndex, domains) { .controller('settingsAddEditEquivalentDomainController', function ($scope, $uibModalInstance, $analytics,
domainIndex, domains) {
$analytics.eventTrack('settingsAddEditEquivalentDomainController', { category: 'Modal' }); $analytics.eventTrack('settingsAddEditEquivalentDomainController', { category: 'Modal' });
$scope.domains = domains; $scope.domains = domains;

View File

@@ -1,7 +1,8 @@
angular angular
.module('bit.settings') .module('bit.settings')
.controller('settingsChangeEmailController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, cipherService, authService, $q, toastr, $analytics) { .controller('settingsChangeEmailController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
cipherService, authService, $q, toastr, $analytics) {
$analytics.eventTrack('settingsChangeEmailController', { category: 'Modal' }); $analytics.eventTrack('settingsChangeEmailController', { category: 'Modal' });
var _masterPasswordHash, var _masterPasswordHash,
_newMasterPasswordHash, _newMasterPasswordHash,

View File

@@ -1,7 +1,8 @@
angular angular
.module('bit.settings') .module('bit.settings')
.controller('settingsDeleteController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, authService, toastr, $analytics) { .controller('settingsDeleteController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
authService, toastr, $analytics) {
$analytics.eventTrack('settingsDeleteController', { category: 'Modal' }); $analytics.eventTrack('settingsDeleteController', { category: 'Modal' });
$scope.submit = function (model) { $scope.submit = function (model) {
var request = { var request = {

View File

@@ -96,6 +96,7 @@
} }
return apiService.settings.putDomains(request, function (domains) { return apiService.settings.putDomains(request, function (domains) {
$analytics.eventTrack('Saved Equivalent Domains');
toastr.success('Domains have been updated.', 'Success!'); toastr.success('Domains have been updated.', 'Success!');
}).$promise; }).$promise;
}; };

View File

@@ -1,7 +1,8 @@
angular angular
.module('bit.settings') .module('bit.settings')
.controller('settingsSessionsController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, authService, toastr, $analytics) { .controller('settingsSessionsController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
authService, toastr, $analytics) {
$analytics.eventTrack('settingsSessionsController', { category: 'Modal' }); $analytics.eventTrack('settingsSessionsController', { category: 'Modal' });
$scope.submit = function (model) { $scope.submit = function (model) {
var request = { var request = {

View File

@@ -1,7 +1,8 @@
angular angular
.module('bit.settings') .module('bit.settings')
.controller('settingsTwoFactorController', function ($scope, apiService, $uibModalInstance, cryptoService, authService, $q, toastr, $analytics) { .controller('settingsTwoFactorController', function ($scope, apiService, $uibModalInstance, cryptoService, authService,
$q, toastr, $analytics) {
$analytics.eventTrack('settingsTwoFactorController', { category: 'Modal' }); $analytics.eventTrack('settingsTwoFactorController', { category: 'Modal' });
var _issuer = 'bitwarden', var _issuer = 'bitwarden',
_profile = null, _profile = null,
@@ -41,9 +42,9 @@
key: formatString(key), key: formatString(key),
recovery: formatString(response.TwoFactorRecoveryCode), recovery: formatString(response.TwoFactorRecoveryCode),
qr: 'https://chart.googleapis.com/chart?chs=120x120&chld=L|0&cht=qr&chl=otpauth://totp/' + qr: 'https://chart.googleapis.com/chart?chs=120x120&chld=L|0&cht=qr&chl=otpauth://totp/' +
_issuer + ':' + encodeURIComponent(_profile.email) + _issuer + ':' + encodeURIComponent(_profile.email) +
'%3Fsecret=' + encodeURIComponent(key) + '%3Fsecret=' + encodeURIComponent(key) +
'%26issuer=' + _issuer '%26issuer=' + _issuer
}; };
} }
@@ -78,6 +79,7 @@
}; };
$scope.print = function (printContent) { $scope.print = function (printContent) {
$analytics.eventTrack('Print Recovery Code');
var w = window.open(); var w = window.open();
w.document.write('<div style="font-size: 18px; text-align: center;"><p>bitwarden two-step login recovery code:</p>' + w.document.write('<div style="font-size: 18px; text-align: center;"><p>bitwarden two-step login recovery code:</p>' +
'<pre>' + printContent + '</pre>'); '<pre>' + printContent + '</pre>');

View File

@@ -1,7 +1,8 @@
angular angular
.module('bit.tools') .module('bit.tools')
.controller('toolsExportController', function ($scope, apiService, authService, $uibModalInstance, cryptoService, cipherService, $q, toastr, $analytics) { .controller('toolsExportController', function ($scope, apiService, authService, $uibModalInstance, cryptoService,
cipherService, $q, toastr, $analytics) {
$analytics.eventTrack('toolsExportController', { category: 'Modal' }); $analytics.eventTrack('toolsExportController', { category: 'Modal' });
$scope.export = function (model) { $scope.export = function (model) {
$scope.startedExport = true; $scope.startedExport = true;
@@ -47,7 +48,9 @@
var csvString = Papa.unparse(exportLogins); var csvString = Papa.unparse(exportLogins);
var csvBlob = new Blob([csvString]); var csvBlob = new Blob([csvString]);
if (window.navigator.msSaveOrOpenBlob) { // IE hack. ref http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
// IE hack. ref http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(csvBlob, makeFileName()); window.navigator.msSaveBlob(csvBlob, makeFileName());
} }
else { else {
@@ -55,7 +58,9 @@
a.href = window.URL.createObjectURL(csvBlob, { type: 'text/plain' }); a.href = window.URL.createObjectURL(csvBlob, { type: 'text/plain' });
a.download = makeFileName(); a.download = makeFileName();
document.body.appendChild(a); document.body.appendChild(a);
a.click(); // IE: "Access is denied". ref: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access // IE: "Access is denied".
// ref: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
a.click();
document.body.removeChild(a); document.body.removeChild(a);
} }

View File

@@ -2,7 +2,7 @@
.module('bit.vault') .module('bit.vault')
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr, .controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
cipherService, $q, $localStorage, $timeout, $rootScope, $state) { cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics) {
$scope.loading = true; $scope.loading = true;
$scope.logins = []; $scope.logins = [];
$scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders; $scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders;
@@ -187,6 +187,7 @@
} }
apiService.logins.del({ id: login.id }, function () { apiService.logins.del({ id: login.id }, function () {
$analytics.eventTrack('Deleted Login');
removeLoginFromScopes(login); removeLoginFromScopes(login);
}); });
}; };
@@ -231,6 +232,7 @@
} }
apiService.folders.del({ id: folder.id }, function () { apiService.folders.del({ id: folder.id }, function () {
$analytics.eventTrack('Deleted Folder');
var index = $rootScope.vaultFolders.indexOf(folder); var index = $rootScope.vaultFolders.indexOf(folder);
if (index > -1) { if (index > -1) {
$rootScope.vaultFolders.splice(index, 1); $rootScope.vaultFolders.splice(index, 1);