diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9bb67c2..de194a3 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,7 +1,8 @@ import {Component, OnInit} from '@angular/core'; -import {Router} from '@angular/router'; +import {Router, NavigationEnd} from '@angular/router'; import {ElectronService} from 'ngx-electron'; import {AngularFirestore} from 'angularfire2/firestore'; +import {filter} from 'rxjs/operators'; @Component({ selector: 'app-root', @@ -15,6 +16,13 @@ export class AppComponent implements OnInit { } ngOnInit() { + // Record routing for analytics + this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => { + (window).ga('set', 'page', event.urlAfterRedirects); + (window).ga('send', 'pageview'); + }); + + // Send electron users right to formula manager if (this.electron.isElectronApp) { this.router.navigate(['/formulaManager']); }