import { Component } from '@angular/core' ; import { Router , NavigationEnd } from '@angular/router' ; @ Component ( { selector : 'app-root' , templateUrl : './app.component.html' , styleUrls : [ './app.component.css' ] } ) export class AppComponent { title = 'Cryptocurrency Market' ; constructor ( private _router ) { this . _router . events . subscribe ( event => { if ( event instanceof NavigationEnd ) { ( < any > window ) . ga ( 'set' , 'page' , event . urlAfterRedirects ) ; ( < any > window ) . ga ( 'send' , 'pageview' ) ; } } ) ; } }