Closed ttizze closed 2 months ago
The changes introduce Google Analytics tracking functionality into the web application. A new file, gtags.client.ts
, implements methods for logging page views and events using the Global Site Tag (gtag.js). The root.tsx
file is updated to retrieve the Google Analytics tracking ID conditionally and to trigger page view events on navigation. Additionally, the loading of Google Tag Manager scripts is optimized based on the presence of the tracking ID.
File | Change Summary |
---|---|
web/app/gtags.client.ts |
Introduces Google Analytics tracking with pageview and event functions, checks for window.gtag , and logs warnings if not defined. |
web/app/root.tsx |
Modifies the loader function to include a conditional gaTrackingId , updates the Layout component to utilize this ID, and adds a useEffect for page view tracking. Conditional rendering for Google Tag Manager scripts is also implemented. |
🐰 In fields of data, I hop with glee,
Tracking each page as quick as can be!
With gtag in hand, I dance through the night,
Events and views, oh what a delight!
Google’s whispers guide my way,
Analytics magic, come join the play! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
Bug Fixes