1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 23:03:32 +00:00

refactor and cleanup analytics class

This commit is contained in:
Kyle Spearrin
2018-01-19 16:19:24 -05:00
parent 34e2cc2e39
commit ee036db2dd
7 changed files with 62 additions and 81 deletions

View File

@@ -11,6 +11,7 @@ import {
import { BrowserApi } from '../browser/browserApi';
import Analytics from '../scripts/analytics';
import MainBackground from './main.background';
import { AutofillService } from '../services/abstractions/autofill.service';
@@ -24,7 +25,7 @@ export default class RuntimeBackground {
constructor(private main: MainBackground, private autofillService: AutofillService,
private cipherService: CipherService, private platformUtilsService: PlatformUtilsService,
private storageService: StorageService, private i18nService: any) {
private storageService: StorageService, private i18nService: any, private analytics: Analytics) {
this.isSafari = this.platformUtilsService.isSafari();
this.runtime = this.isSafari ? safari.application : chrome.runtime;
@@ -190,7 +191,7 @@ export default class RuntimeBackground {
});
await this.cipherService.saveWithServer(cipher);
(window as any).ga('send', {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Added Login from Notification Bar',
});
@@ -284,7 +285,7 @@ export default class RuntimeBackground {
await this.reseedStorage();
}
(window as any).ga('send', {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'onInstalled ' + this.onInstalledReason,
});