1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-29 22:31:29 +01:00

no analytics if in safari private window

This commit is contained in:
Kyle Spearrin 2018-01-15 22:35:00 -05:00
parent 618ac4c208
commit 1c9030a52c

View File

@ -13,6 +13,7 @@ export default class Analytics {
private appIdService: AppIdService;
private gaTrackingId: string = null;
private isFirefox = false;
private isSafari = false;
private gaFunc: Function = null;
private win: any;
private isBackground: boolean = false;
@ -35,6 +36,7 @@ export default class Analytics {
this.win = win;
this.isFirefox = this.platformUtilsService.isFirefox();
this.isSafari = this.platformUtilsService.isSafari();
this.gaTrackingId = this.platformUtilsService.analyticsId();
this.isBackground = (typeof this.win.bitwardenIsBackground !== 'undefined');
}
@ -56,6 +58,10 @@ export default class Analytics {
return;
}
if (this.isSafari && safari.application.activeBrowserWindow.activeTab.private) {
return;
}
const disabled = await this.storageService.get<boolean>('disableGa');
// Default for Firefox is disabled.
if ((this.isFirefox && disabled == null) || disabled != null && disabled) {