mirror of
https://github.com/jwetzell/itsfiveoclockwhere.git
synced 2026-08-12 10:43:39 +00:00
add google analytics
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
|
||||
declare let gtag: Function;
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
@@ -6,5 +9,13 @@ import { Component } from '@angular/core';
|
||||
})
|
||||
export class AppComponent {
|
||||
|
||||
constructor() { }
|
||||
constructor(public router: Router) {
|
||||
this.router.events.subscribe(event => {
|
||||
if (event instanceof NavigationEnd) {
|
||||
gtag('config', 'G-48B6CKS0V6',{
|
||||
'page_path': event.urlAfterRedirects
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user