1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-24 11:55:50 +01:00

add analytics support

This commit is contained in:
Kyle Spearrin 2018-01-26 10:50:06 -05:00
parent 5b92d9d31f
commit 0f5af81bd9
5 changed files with 21 additions and 1 deletions

View File

@ -51,6 +51,8 @@
"@angular/upgrade": "5.2.0", "@angular/upgrade": "5.2.0",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"rxjs": "^5.5.6", "rxjs": "^5.5.6",
"zone.js": "^0.8.19" "zone.js": "^0.8.19",
"angular2-toaster": "4.0.2",
"angulartics2": "5.0.1"
} }
} }

View File

@ -1,3 +1,5 @@
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
@ -6,4 +8,6 @@ import { Component } from '@angular/core';
template: '<router-outlet></router-outlet>', template: '<router-outlet></router-outlet>',
}) })
export class AppComponent { export class AppComponent {
constructor(angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics) {
}
} }

View File

@ -1,6 +1,8 @@
import 'core-js'; import 'core-js';
import 'zone.js/dist/zone'; import 'zone.js/dist/zone';
import { Angulartics2Module } from 'angulartics2';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
@ -27,6 +29,11 @@ import { ViewComponent } from './vault/view.component';
FormsModule, FormsModule,
AppRoutingModule, AppRoutingModule,
ServicesModule, ServicesModule,
Angulartics2Module.forRoot([Angulartics2GoogleAnalytics], {
pageTracking: {
clearQueryParams: true,
},
}),
], ],
declarations: [ declarations: [
AddComponent, AddComponent,

View File

@ -11,6 +11,8 @@ import { DesktopStorageService } from '../../services/desktopStorage.service';
import { DesktopSecureStorageService } from '../../services/desktopSecureStorage.service'; import { DesktopSecureStorageService } from '../../services/desktopSecureStorage.service';
import { I18nService } from '../../services/i18n.service'; import { I18nService } from '../../services/i18n.service';
import { Analytics } from 'jslib/misc/analytics';
import { import {
ApiService, ApiService,
AppIdService, AppIdService,
@ -90,6 +92,7 @@ const authService: AuthServiceAbstraction = new AuthService(cryptoService, apiSe
userService, tokenService, appIdService, platformUtilsService, constantsService, userService, tokenService, appIdService, platformUtilsService, constantsService,
messagingService); messagingService);
const analytics = new Analytics(window, null, platformUtilsService, storageService, appIdService);
containerService.attachToWindow(window); containerService.attachToWindow(window);
environmentService.setUrlsFromStorage().then(() => { environmentService.setUrlsFromStorage().then(() => {
return syncService.fullSync(true); return syncService.fullSync(true);

View File

@ -120,4 +120,8 @@ export class DesktopPlatformUtilsService implements PlatformUtilsService {
message: message, message: message,
}); });
} }
getApplicationVersion(): string {
return (window as any).require('electron').remote.app.getVersion();
}
} }