Skip to content

Commit

Permalink
fix: safer window.gtag declaration (doesn't override previous one)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Oct 4, 2024
1 parent e438c95 commit 282ca50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/analytics/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function loadGTag(gtagId: string, enabled = true): Promise<void> {
if (isServerSide()) return

window.dataLayer ||= []
window.gtag = () => {
window.gtag ||= () => {
// biome-ignore lint/style/noArguments: ok
window.dataLayer.push(arguments)
}
Expand Down

0 comments on commit 282ca50

Please sign in to comment.