From 282ca50582a79bfb69052a93db352fe9b293ba2d Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Fri, 4 Oct 2024 08:36:04 +0200 Subject: [PATCH] fix: safer window.gtag declaration (doesn't override previous one) --- src/analytics/analytics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analytics/analytics.ts b/src/analytics/analytics.ts index e642f50..c6d23b0 100644 --- a/src/analytics/analytics.ts +++ b/src/analytics/analytics.ts @@ -17,7 +17,7 @@ export async function loadGTag(gtagId: string, enabled = true): Promise { if (isServerSide()) return window.dataLayer ||= [] - window.gtag = () => { + window.gtag ||= () => { // biome-ignore lint/style/noArguments: ok window.dataLayer.push(arguments) }