We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 448c51f commit 73c58cfCopy full SHA for 73c58cf
1 file changed
projects/ngqp-demo/src/app/shared/analytics.service.ts
@@ -1,6 +1,6 @@
1
import { Injectable } from '@angular/core';
2
import { NavigationEnd, Router } from '@angular/router';
3
-import { filter, map } from 'rxjs/operators';
+import { distinctUntilChanged, filter, map } from 'rxjs/operators';
4
5
declare const gtag: Function;
6
@@ -21,9 +21,9 @@ export class AnalyticsService {
21
router.events.pipe(
22
filter(event => event instanceof NavigationEnd),
23
map(event => event as NavigationEnd),
24
- ).subscribe(event => {
25
- const url = event.urlAfterRedirects;
26
-
+ map(event => event.urlAfterRedirects),
+ distinctUntilChanged(),
+ ).subscribe(url => {
27
try {
28
gtag('config', 'UA-131508204-1', { 'page_path': url });
29
} catch (ignored) {
0 commit comments