mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-01 13:13:36 +01:00
added setting to disable google analytics
This commit is contained in:
parent
42830e5793
commit
9f12079f05
@ -1,8 +1,19 @@
|
|||||||
angular
|
angular
|
||||||
.module('bit.settings')
|
.module('bit.settings')
|
||||||
|
|
||||||
.controller('settingsController', function ($scope, loginService, $state, SweetAlert, utilsService, $analytics, i18nService) {
|
.controller('settingsController', function ($scope, loginService, $state, SweetAlert, utilsService, $analytics,
|
||||||
|
i18nService) {
|
||||||
|
var gaKey = 'disableGa';
|
||||||
|
|
||||||
|
$scope.disableGa = false;
|
||||||
$scope.i18n = i18nService;
|
$scope.i18n = i18nService;
|
||||||
|
|
||||||
|
chrome.storage.local.get(gaKey, function (obj) {
|
||||||
|
if (obj && obj[gaKey]) {
|
||||||
|
$scope.disableGa = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$scope.logOut = function () {
|
$scope.logOut = function () {
|
||||||
SweetAlert.swal({
|
SweetAlert.swal({
|
||||||
title: 'Log Out',
|
title: 'Log Out',
|
||||||
@ -69,6 +80,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.updateGa = function () {
|
||||||
|
chrome.storage.local.get(gaKey, function (obj) {
|
||||||
|
if (obj[gaKey]) {
|
||||||
|
// enable
|
||||||
|
obj[gaKey] = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// disable
|
||||||
|
obj[gaKey] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
chrome.storage.local.set(obj, function () {
|
||||||
|
$scope.disableGa = obj[gaKey];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.rate = function () {
|
$scope.rate = function () {
|
||||||
$analytics.eventTrack('Rate Extension');
|
$analytics.eventTrack('Rate Extension');
|
||||||
|
|
||||||
@ -94,6 +122,5 @@
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
{{i18n.other}}
|
{{i18n.other}}
|
||||||
</div>
|
</div>
|
||||||
<div class="list-section-items">
|
<div class="list-section-items">
|
||||||
|
<div class="list-section-item list-section-item-checkbox">
|
||||||
|
<label for="ga">Disable Google Analytics</label>
|
||||||
|
<input id="ga" type="checkbox" ng-model="disableGa" ng-change="updateGa()">
|
||||||
|
</div>
|
||||||
<a class="list-section-item" ui-sref="about({animation: 'in-slide-left'})">
|
<a class="list-section-item" ui-sref="about({animation: 'in-slide-left'})">
|
||||||
{{i18n.about}}
|
{{i18n.about}}
|
||||||
<i class="fa fa-chevron-right fa-lg"></i>
|
<i class="fa fa-chevron-right fa-lg"></i>
|
||||||
|
@ -5,7 +5,13 @@ window.ga = function (action, param1, param2, param3, param4) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chrome.storage.local.get('disableGa', function (obj) {
|
||||||
|
if (obj && obj['disableGa']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gaFunc(action, param1, param2, param3, param4);
|
gaFunc(action, param1, param2, param3, param4);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function gaTrackEvent(options) {
|
function gaTrackEvent(options) {
|
||||||
@ -13,13 +19,11 @@ function gaTrackEvent(options) {
|
|||||||
'&ea=' + encodeURIComponent(options.eventAction) +
|
'&ea=' + encodeURIComponent(options.eventAction) +
|
||||||
(options.eventLabel ? '&el=' + encodeURIComponent(options.eventLabel) : '') +
|
(options.eventLabel ? '&el=' + encodeURIComponent(options.eventLabel) : '') +
|
||||||
(options.eventValue ? '&ev=' + encodeURIComponent(options.eventValue) : '') +
|
(options.eventValue ? '&ev=' + encodeURIComponent(options.eventValue) : '') +
|
||||||
(options.page ? '&dp=' + encodeURIComponent(options.page) : '') +
|
(options.page ? '&dp=' + encodeURIComponent(options.page) : '');
|
||||||
(document && document.title ? '&dt=' + encodeURIComponent(document.title) : '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gaTrackPageView(pagePath) {
|
function gaTrackPageView(pagePath) {
|
||||||
return '&t=pageview&dp=' + encodeURIComponent(pagePath) +
|
return '&t=pageview&dp=' + encodeURIComponent(pagePath);
|
||||||
(document && document.title ? '&dt=' + encodeURIComponent(document.title) : '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.extension.getBackgroundPage().appIdService.getAnonymousAppId(function (gaAnonAppId) {
|
chrome.extension.getBackgroundPage().appIdService.getAnonymousAppId(function (gaAnonAppId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user