From dd138335f72b9ce4c595a76b048e224436e68447 Mon Sep 17 00:00:00 2001 From: wurmloch Date: Thu, 29 Oct 2020 00:52:32 +0100 Subject: [PATCH] fix(analytics): analytics.service check whether ga function exists #5529 --- src/app/@core/utils/analytics.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/@core/utils/analytics.service.ts b/src/app/@core/utils/analytics.service.ts index 20dcc02c..155f8d6b 100644 --- a/src/app/@core/utils/analytics.service.ts +++ b/src/app/@core/utils/analytics.service.ts @@ -10,7 +10,12 @@ export class AnalyticsService { private enabled: boolean; constructor(private location: Location, private router: Router) { - this.enabled = false; + this.enabled = true; + this.handleGaAvailability(); + } + + private handleGaAvailability() { + this.enabled = (typeof ga === 'function'); } trackPageViews() {