|
|
|
@ -30,14 +30,16 @@ export class AnalyticsService { |
|
|
|
}; |
|
|
|
|
|
|
|
if (analyticsId && router && resourceLoader && window.location.hostname !== 'localhost') { |
|
|
|
this.gtag('config', analyticsId.value); |
|
|
|
this.gtag('config', analyticsId.value, { anonymize_ip: true }); |
|
|
|
|
|
|
|
router.events.filter(e => Types.is(e, NavigationEnd)) |
|
|
|
.subscribe(() => { |
|
|
|
this.gtag('config', analyticsId.value, { page_path: window.location.pathname }); |
|
|
|
this.gtag('config', analyticsId.value, { page_path: window.location.pathname, anonymize_ip: true }); |
|
|
|
}); |
|
|
|
|
|
|
|
resourceLoader.loadScript(`https://www.googletagmanager.com/gtag/js?id=${analyticsId.value}`); |
|
|
|
if (document.cookie.indexOf('ga-disable') < 0) { |
|
|
|
resourceLoader.loadScript(`https://www.googletagmanager.com/gtag/js?id=${analyticsId.value}`); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|