1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +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

@@ -1,5 +1,6 @@
import { BrowserApi } from '../browser/browserApi';
import Analytics from '../scripts/analytics';
import MainBackground from './main.background';
import {
@@ -16,7 +17,7 @@ export default class CommandsBackground {
private isVivaldi: boolean;
constructor(private main: MainBackground, private passwordGenerationService: PasswordGenerationService,
private platformUtilsService: PlatformUtilsService) {
private platformUtilsService: PlatformUtilsService, private analytics: Analytics) {
this.isSafari = this.platformUtilsService.isSafari();
this.isEdge = this.platformUtilsService.isEdge();
this.isVivaldi = this.platformUtilsService.isVivaldi();
@@ -68,7 +69,7 @@ export default class CommandsBackground {
UtilsService.copyToClipboard(password);
this.passwordGenerationService.addHistory(password);
(window as any).ga('send', {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Generated Password From Command',
});
@@ -85,7 +86,7 @@ export default class CommandsBackground {
this.main.collectPageDetailsForContentScript(tab, 'autofill_cmd');
(window as any).ga('send', {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Autofilled From Command',
});
@@ -98,7 +99,7 @@ export default class CommandsBackground {
}
this.main.openPopup();
(window as any).ga('send', {
this.analytics.ga('send', {
hitType: 'event',
eventAction: 'Opened Popup From Command',
});