Commit 66ac6738 authored by Ryan Diehl's avatar Ryan Diehl

fix(analytics): pull in typing fixes

parent 47d2fb2b
Pipeline #101510 passed with stages
in 4 minutes and 51 seconds
......@@ -2,6 +2,13 @@ import { isPlatformBrowser } from '@angular/common';
import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
import { AnalyticsConfig, AnalyticsSource, ANALYTICS_CONFIG } from './analytics.model';
declare global {
interface Window {
dataLayer: unknown[];
gtag: Function;
}
}
@Injectable({ providedIn: 'root' })
export class GoogleAnalyticsService implements AnalyticsSource {
private gtag: Function;
......@@ -22,11 +29,11 @@ export class GoogleAnalyticsService implements AnalyticsSource {
this.scriptLoaded = true;
if (typeof window !== 'undefined') {
window['dataLayer'] = window['dataLayer'] || [];
window['gtag'] = function(): void {
window['dataLayer'].push(arguments);
window.dataLayer = window.dataLayer || [];
window.gtag = function(): void {
window.dataLayer.push(arguments);
};
window['gtag']('js', new Date());
window.gtag('js', new Date());
}
const doc = <HTMLDivElement>document.body;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment