1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

analytics event tracking

This commit is contained in:
Kyle Spearrin
2016-09-27 23:19:33 -04:00
parent a727e107fe
commit 96c8a99173
17 changed files with 86 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
.module('bit.tools')
.controller('toolsPasswordGeneratorController', function ($scope, $state, $stateParams, passwordGenerationService,
toastr, $q, utilsService) {
toastr, $q, utilsService, $analytics) {
var addState = $stateParams.addState,
editState = $stateParams.editState;
@@ -21,9 +21,10 @@
hidePointerLabels: true,
onChange: function () {
$scope.options.length = $scope.slider.value;
$scope.regenerate();
$scope.regenerate(false);
},
onEnd: function () {
$analytics.eventTrack('Generated Password');
$scope.saveOptions($scope.options);
}
}
@@ -32,10 +33,15 @@
$q.when(passwordGenerationService.getOptions()).then(function (options) {
$scope.options = options;
$scope.slider.value = options.length;
$scope.regenerate();
$scope.regenerate(false);
$analytics.eventTrack('Generated Password');
});
$scope.regenerate = function () {
$scope.regenerate = function (trackRegenerateEvent) {
if (trackRegenerateEvent) {
$analytics.eventTrack('Regenerated Password');
}
$scope.password = passwordGenerationService.generatePassword($scope.options);
};
@@ -51,7 +57,7 @@
}
passwordGenerationService.saveOptions(options);
$scope.regenerate();
$scope.regenerate(false);
};
$scope.clipboardError = function (e, password) {
@@ -59,6 +65,7 @@
};
$scope.clipboardSuccess = function (e) {
$analytics.eventTrack('Copied Generated Password');
e.clearSelection();
toastr.info('Password copied!');
};
@@ -68,6 +75,8 @@
};
$scope.select = function () {
$analytics.eventTrack('Selected Generated Password');
if (addState) {
addState.site.password = $scope.password;
}