Skip to content

Commit

Permalink
refactor: use globalThis
Browse files Browse the repository at this point in the history
  • Loading branch information
mya-ake committed Jan 29, 2024
1 parent 9700ce5 commit e5af1b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion islands/Gtag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect } from "preact/hooks";
import { gtag } from "@shared/gtag/mod.ts";

function init(gaTagId: string) {
window.dataLayer = window.dataLayer || [];
globalThis.dataLayer = globalThis.dataLayer || [];

gtag("consent", "default", {
"analytics_storage": "denied",
Expand Down
5 changes: 2 additions & 3 deletions shared/gtag/type.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
interface Window {
dataLayer: unknown[];
}
// deno-lint-ignore no-var
declare var dataLayer: unknown[];

0 comments on commit e5af1b3

Please sign in to comment.