Conversation
✅ Deploy Preview for node-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vue-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for qwik-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for system-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for angular-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for solid-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for svelte-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for graphql-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for react-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for deno-framework-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Add gtag to global var
Content addition
Bug fix
Behavior change
Summary of change
Fixed
Uncaught ReferenceError: gtag is not definederror by ensuringgtagis properly attached to the globalwindowobject and adding safety checks before calling it. Thetrack()function inanalytics-utils.tsnow verifies thatwindow.gtagexists before attempting to call it, preventing runtime errors when the Google Analytics script hasn't loaded yet or in development mode.Checklist
This fix resolves #
The changes follow the contributing guidelines
I have verified the fix works and introduces no further errors
Changes Made
packages/system/src/util/analytics-utils.ts: Added safety checks to verifywindow.gtagexists before calling it, preventingReferenceErrorwhen gtag is not available.packages/site/src/layouts/base.astro: Addedwindow.gtag = gtag;to explicitly attach the gtag function to the global window object in the inline script.packages/landing-site/src/pages/index.astro: Addedwindow.gtag = gtag;to explicitly attach the gtag function to the global window object in the inline script.