Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds Google Analytics (GA4/gtag) instrumentation to the Next.js website to track page views and key CTA/download link clicks, plus includes an unrelated SwiftUI keyboard-dismiss-on-scroll change in the mobile app.
Changes:
- Add GA script injection + page-view tracking and a helper to emit custom analytics events.
- Replace several CTA/download anchors with a
TrackedLinkcomponent that reports click events. - Introduce a SwiftUI modifier to dismiss the keyboard on scroll in the mobile chat view.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| website/README.md | Documents the NEXT_PUBLIC_GOOGLE_ANALYTICS_ID env var needed to enable analytics. |
| website/app/analytics.tsx | Adds GA script loader and trackAnalyticsEvent helper + event name typings. |
| website/app/page-view-tracker.tsx | Adds client-side page_view event emission on route changes. |
| website/app/tracked-link.tsx | Adds a reusable tracked anchor component for CTA/download links. |
| website/app/layout.tsx | Wires analytics/page-view tracking into the root layout. |
| website/app/page.tsx | Converts key homepage CTAs to TrackedLink with event metadata. |
| website/app/release/page.tsx | Converts release download links to TrackedLink with event metadata. |
| RxCodeMobile/Views/MobileKeyboardDismissModifier.swift | Changes keyboard dismissal behavior during scroll (mobile). |
| RxCodeMobile/Views/MobileChatView.swift | Switches chat scroll view to the new keyboard-dismiss modifier. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+71
to
+72
| </body> | ||
| <GoogleAnalytics /> |
Comment on lines
+3
to
+22
| import { usePathname } from "next/navigation"; | ||
| import { useEffect } from "react"; | ||
| import { isGoogleAnalyticsEnabled } from "./analytics"; | ||
|
|
||
| export function PageViewTracker() { | ||
| const pathname = usePathname(); | ||
|
|
||
| useEffect(() => { | ||
| if (!isGoogleAnalyticsEnabled || typeof window === "undefined") { | ||
| return; | ||
| } | ||
|
|
||
| const pagePath = `${window.location.pathname}${window.location.search}`; | ||
|
|
||
| window.gtag?.("event", "page_view", { | ||
| page_path: pagePath, | ||
| page_location: window.location.href, | ||
| page_title: document.title, | ||
| }); | ||
| }, [pathname]); |
Comment on lines
+29
to
+35
| trackAnalyticsEvent(analyticsEventName, { | ||
| label: analyticsLabel, | ||
| location: analyticsLocation, | ||
| link_url: href ?? null, | ||
| transport_type: "beacon", | ||
| }); | ||
| onClick?.(event); |
Comment on lines
1
to
+28
| import SwiftUI | ||
| import UIKit | ||
|
|
||
| private struct MobileKeyboardDismissOnScrollModifier: ViewModifier { | ||
| let mode: ScrollDismissesKeyboardMode | ||
| @GestureState private var isDragging = false | ||
|
|
||
| func body(content: Content) -> some View { | ||
| content | ||
| .scrollDismissesKeyboard(mode) | ||
| .simultaneousGesture( | ||
| DragGesture(minimumDistance: 2) | ||
| .updating($isDragging) { _, state, _ in | ||
| if !state { | ||
| UIApplication.shared.dismissKeyboard() | ||
| } | ||
| state = true | ||
| } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| extension View { | ||
| func mobileDismissesKeyboardOnScroll( | ||
| _ mode: ScrollDismissesKeyboardMode = .interactively | ||
| ) -> some View { | ||
| scrollDismissesKeyboard(mode) | ||
| modifier(MobileKeyboardDismissOnScrollModifier(mode: mode)) | ||
| } |
Contributor
Author
|
🎉 This PR is included in version 1.9.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.