Closed laholstege closed 4 months ago
The recent changes introduce Google Tag Manager (GTM) and Google Analytics tracking into the application. This includes adding GTM environment variables, replacing the GoogleTagManager
component with GtagProvider
, and integrating event tracking for various user interactions such as feedback, sharing, and copying URLs. Additionally, new constants and a custom hook for GTM events are implemented to streamline event handling throughout the application.
File Path | Change Summary |
---|---|
.env |
Added GTM_ID and GTM_DEV_AUTH variables for Google Tag Manager. |
src/app/layout.tsx |
Replaced GoogleTagManager with GtagProvider . |
src/components/chat/answer/chatActions.tsx |
Added useGtagEvent and GTagEvents for tracking copy events. |
src/components/chat/answer/feedbackButtons.tsx |
Updated feedback handling to use ChatHistory and new GTM event constants. |
src/components/chat/answer/shareButtons.tsx |
Replaced string literals with GTagEvents constants for loading state checks. |
src/components/chat/answer/shareModal.tsx |
Refactored share modal event handling to use GTagEvents constants. |
src/components/chat/answer/sharedUrl.tsx |
Added handleCopyShareUrl function for tracking URL copy events. |
src/components/chat/answer/wonkMessage.tsx |
Added GTM tracking for external and internal link clicks. |
src/components/chat/ask/chatInput.tsx |
Integrated aiState with gtagEvent for enhanced tracking. |
src/components/chat/ask/chatBoxForm.tsx |
Removed server actions comment from onSubmit handler. |
src/components/ui/copyToClipboardButton.tsx |
Added onClick prop to trigger GTM events on copy actions. |
src/lib/gtag.tsx |
Added new GTM event enums and updated existing ones. |
src/lib/hooks/useGtagEvent.tsx |
Introduced useGtagEvent hook for sending GTM events. |
src/lib/hooks/useStreamableText.ts |
Added 'use client'; statement. |
In the code, new paths align,
GTM events now intertwine,
Feedback, shares, and clicks we see,
Tracked with ease, analytics spree.
WithGtagProvider
in the mix,
Our insights grow, our data clicks.
Cheers to changes, sleek and fine,
In the code, new stars now shine! 🌟
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?
cleans up gtags, adds llm_model tracking, makes everything a custom event so we can pass our custom variables every time. most of the work is on GTM and setting up a real dev environment and making sure we are and always will exclude dev traffic
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Refactor
GoogleTagManager
withGtagProvider
for improved analytics integration.Chores