🆒 Your use case
window.gtag exists but lacks a type declaration.
useScriptGoogleTagManager({
id: "GTM-xxxxxxxxx",
});
onMounted(() => {
console.log(window.fbq); // ok
console.log(window.gtag); // error: Property 'gtag' does not exist on type 'Window & typeof globalThis'
});
🆕 The solution you'd like
You can extend the global Window interface just like with Meta Pixel by writing:
// node_modules/@nuxt/scripts/dist/runtime/registry/meta-pixel.d.ts
declare global {
interface Window extends MetaPixelApi {
}
}
🔍 Alternatives you've considered
No response
ℹ️ Additional info
No response