Spaces:
Runtime error
Runtime error
File size: 423 Bytes
0b3caef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// lib/gtm.ts
type WindowWithDataLayer = Window & {
dataLayer: Record<string, any>[]
}
declare const window: WindowWithDataLayer
export const GTM_ID = "GTM-WKJGXLNK"
export const pageview = (url: string) => {
if (typeof window.dataLayer !== "undefined") {
window.dataLayer.push({
event: "pageview",
page: url,
})
} else {
console.log({
event: "pageview",
page: url,
})
}
} |