Skip to content

feat: add website analytics tracking#38

Merged
sirily11 merged 1 commit into
mainfrom
analytics
May 21, 2026
Merged

feat: add website analytics tracking#38
sirily11 merged 1 commit into
mainfrom
analytics

Conversation

@sirily11
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 21, 2026 08:59
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rxcode Ready Ready Preview, Comment May 21, 2026 8:59am

Request Review

@autopilot-project-manager autopilot-project-manager Bot added the enhancement New feature or request label May 21, 2026
@sirily11 sirily11 enabled auto-merge (squash) May 21, 2026 09:00
@sirily11 sirily11 merged commit 8133aa0 into main May 21, 2026
10 checks passed
@sirily11 sirily11 deleted the analytics branch May 21, 2026 09:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TrackedLink component 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 thread website/app/layout.tsx
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))
}
@sirily11
Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 1.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants