fix(analytics): analytics.service check whether ga function exists #5529

This commit is contained in:
wurmloch 2020-10-29 00:52:32 +01:00
parent 7ad3fff370
commit dd138335f7

View file

@ -10,7 +10,12 @@ export class AnalyticsService {
private enabled: boolean; private enabled: boolean;
constructor(private location: Location, private router: Router) { constructor(private location: Location, private router: Router) {
this.enabled = false; this.enabled = true;
this.handleGaAvailability();
}
private handleGaAvailability() {
this.enabled = (typeof ga === 'function');
} }
trackPageViews() { trackPageViews() {