1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-24 16:49:26 +01:00

analytics for firefox are disabled by default

This commit is contained in:
Kyle Spearrin 2017-02-24 23:49:36 -05:00
parent 6c5786c46c
commit 895fee0815
2 changed files with 16 additions and 4 deletions

View File

@ -1,18 +1,22 @@
angular
.module('bit.settings')
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService) {
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService, utilsService) {
$scope.i18n = i18nService;
$scope.disableGa = false;
$scope.disableAddLoginNotification = false;
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
if (obj && obj[constantsService.disableGaKey]) {
// Default for Firefox is disabled.
if ((utilsService.isFirefox() && obj[constantsService.disableGaKey] === undefined) ||
obj[constantsService.disableGaKey]) {
$scope.disableGa = true;
}
else {
$scope.disableGa = false;
}
$scope.$apply();
});
chrome.storage.local.get(constantsService.disableAddLoginNotificationKey, function (obj) {
@ -22,11 +26,15 @@
else {
$scope.disableAddLoginNotification = false;
}
$scope.$apply();
});
$scope.updateGa = function () {
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
if (obj[constantsService.disableGaKey]) {
// Default for Firefox is disabled.
if ((utilsService.isFirefox() && obj[constantsService.disableGaKey] === undefined) ||
obj[constantsService.disableGaKey]) {
// enable
obj[constantsService.disableGaKey] = false;
}
@ -38,6 +46,7 @@
chrome.storage.local.set(obj, function () {
$scope.disableGa = obj[constantsService.disableGaKey];
$scope.$apply();
if (!obj[constantsService.disableGaKey]) {
$analytics.eventTrack('Enabled Google Analytics');
}
@ -59,6 +68,7 @@
chrome.storage.local.set(obj, function () {
$scope.disableAddLoginNotification = obj[constantsService.disableAddLoginNotificationKey];
$scope.$apply();
if (!obj[constantsService.disableAddLoginNotificationKey]) {
$analytics.eventTrack('Enabled Add Login Notification');
}

View File

@ -1,5 +1,6 @@
var gaTrackingId = chrome.extension.getBackgroundPage().utilsService.analyticsId();
var gaFunc = null;
var isFirefox = chrome.extension.getBackgroundPage().utilsService.isFirefox();
window.GoogleAnalyticsObject = 'ga';
window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3, param4) {
@ -8,7 +9,8 @@ window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3,
}
chrome.storage.local.get('disableGa', function (obj) {
if (obj && obj['disableGa']) {
// Default for Firefox is disabled.
if ((isFirefox && obj['disableGa'] === undefined) || obj['disableGa']) {
return;
}