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",
"core-js": "^2.4.1",
"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';
@Component({
@ -6,4 +8,6 @@ import { Component } from '@angular/core';
template: '<router-outlet></router-outlet>',
})
export class AppComponent {
constructor(angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics) {
}
}

View File

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

View File

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

View File

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