diff --git a/src/popup/app/settings/settingsFeaturesController.js b/src/popup/app/settings/settingsFeaturesController.js index 9896201355..50083bb144 100644 --- a/src/popup/app/settings/settingsFeaturesController.js +++ b/src/popup/app/settings/settingsFeaturesController.js @@ -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'); } diff --git a/src/scripts/analytics.js b/src/scripts/analytics.js index bdd1f63263..48d074a063 100644 --- a/src/scripts/analytics.js +++ b/src/scripts/analytics.js @@ -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; }