Browse Source

Anonymize tracking.

pull/296/head
Sebastian 8 years ago
parent
commit
888a01407f
  1. 8
      src/Squidex/app/framework/services/analytics.service.ts

8
src/Squidex/app/framework/services/analytics.service.ts

@ -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}`);
}
}
}

Loading…
Cancel
Save