analytics for firefox are disabled by default
This commit is contained in:
parent
6c5786c46c
commit
895fee0815
|
@ -1,18 +1,22 @@
|
||||||
angular
|
angular
|
||||||
.module('bit.settings')
|
.module('bit.settings')
|
||||||
|
|
||||||
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService) {
|
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService, utilsService) {
|
||||||
$scope.i18n = i18nService;
|
$scope.i18n = i18nService;
|
||||||
$scope.disableGa = false;
|
$scope.disableGa = false;
|
||||||
$scope.disableAddLoginNotification = false;
|
$scope.disableAddLoginNotification = false;
|
||||||
|
|
||||||
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
|
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;
|
$scope.disableGa = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$scope.disableGa = false;
|
$scope.disableGa = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.storage.local.get(constantsService.disableAddLoginNotificationKey, function (obj) {
|
chrome.storage.local.get(constantsService.disableAddLoginNotificationKey, function (obj) {
|
||||||
|
@ -22,11 +26,15 @@
|
||||||
else {
|
else {
|
||||||
$scope.disableAddLoginNotification = false;
|
$scope.disableAddLoginNotification = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.updateGa = function () {
|
$scope.updateGa = function () {
|
||||||
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
|
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
|
// enable
|
||||||
obj[constantsService.disableGaKey] = false;
|
obj[constantsService.disableGaKey] = false;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +46,7 @@
|
||||||
|
|
||||||
chrome.storage.local.set(obj, function () {
|
chrome.storage.local.set(obj, function () {
|
||||||
$scope.disableGa = obj[constantsService.disableGaKey];
|
$scope.disableGa = obj[constantsService.disableGaKey];
|
||||||
|
$scope.$apply();
|
||||||
if (!obj[constantsService.disableGaKey]) {
|
if (!obj[constantsService.disableGaKey]) {
|
||||||
$analytics.eventTrack('Enabled Google Analytics');
|
$analytics.eventTrack('Enabled Google Analytics');
|
||||||
}
|
}
|
||||||
|
@ -59,6 +68,7 @@
|
||||||
|
|
||||||
chrome.storage.local.set(obj, function () {
|
chrome.storage.local.set(obj, function () {
|
||||||
$scope.disableAddLoginNotification = obj[constantsService.disableAddLoginNotificationKey];
|
$scope.disableAddLoginNotification = obj[constantsService.disableAddLoginNotificationKey];
|
||||||
|
$scope.$apply();
|
||||||
if (!obj[constantsService.disableAddLoginNotificationKey]) {
|
if (!obj[constantsService.disableAddLoginNotificationKey]) {
|
||||||
$analytics.eventTrack('Enabled Add Login Notification');
|
$analytics.eventTrack('Enabled Add Login Notification');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
var gaTrackingId = chrome.extension.getBackgroundPage().utilsService.analyticsId();
|
var gaTrackingId = chrome.extension.getBackgroundPage().utilsService.analyticsId();
|
||||||
var gaFunc = null;
|
var gaFunc = null;
|
||||||
|
var isFirefox = chrome.extension.getBackgroundPage().utilsService.isFirefox();
|
||||||
|
|
||||||
window.GoogleAnalyticsObject = 'ga';
|
window.GoogleAnalyticsObject = 'ga';
|
||||||
window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3, param4) {
|
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) {
|
chrome.storage.local.get('disableGa', function (obj) {
|
||||||
if (obj && obj['disableGa']) {
|
// Default for Firefox is disabled.
|
||||||
|
if ((isFirefox && obj['disableGa'] === undefined) || obj['disableGa']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue