Skip to content

feat: Track visitors with Vercel Analytics#2

Merged
shrink merged 2 commits intomainfrom
sam/add-vercel-analytics
Mar 17, 2026
Merged

feat: Track visitors with Vercel Analytics#2
shrink merged 2 commits intomainfrom
sam/add-vercel-analytics

Conversation

@shrink
Copy link
Member

@shrink shrink commented Mar 17, 2026

Summary by CodeRabbit

  • New Features
    • Integrated analytics tracking throughout the site to monitor and measure user engagement, interaction patterns, and behavioral metrics for improved insights.
    • Implemented automatic tracking of user clicks on navigation links and other interactive elements to capture detailed engagement data and user activity patterns.

Copilot AI review requested due to automatic review settings March 17, 2026 13:56
@vercel
Copy link

vercel bot commented Mar 17, 2026

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

Project Deployment Actions Updated (UTC)
shr-ink Ready Ready Preview, Comment Mar 17, 2026 1:56pm

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Walkthrough

Vercel Analytics integration is added to the project. A new dependency is installed via package.json, and the index.astro page imports the Analytics component while adding client-side event tracking for anchor link clicks.

Changes

Cohort / File(s) Summary
Dependency Management
package.json
Added @vercel/analytics dependency (^2.0.1) to track analytics data.
Analytics Integration
src/pages/index.astro
Imported and rendered Analytics component from @vercel/analytics/astro; added client-side script with event delegation to track click events on anchor links.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A metrics dream, now in sight,
Analytics bundled, shining bright!
Each click recorded, tracked with care,
User journeys floating through the air. 📊✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: adding Vercel Analytics for visitor tracking.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sam/add-vercel-analytics
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

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 Vercel Analytics to the Astro homepage to capture visitor analytics and link click events.

Changes:

  • Add @vercel/analytics dependency.
  • Render the Astro <Analytics /> component on the homepage.
  • Add a client-side click listener to send track("click", { href }) events for anchor clicks.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/pages/index.astro Adds the Vercel Analytics component and a custom client-side click tracking script.
package.json Adds @vercel/analytics dependency.
pnpm-lock.yaml Locks @vercel/analytics@2.0.1.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/index.astro`:
- Around line 125-139: The click handler currently calls track("click", { href:
link.href }) and may leak query strings or fragments; change it to compute a
sanitizedHref from the clicked anchor by constructing a URL from link.href and
using only its origin + pathname (or pathname alone, as desired) so search and
hash are omitted, then pass that sanitizedHref in the track call (update the
code around document.addEventListener(...) / target.closest("a") / track to use
the new sanitized value).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 257c3eb5-9ed1-4131-b5e2-fb99442023db

📥 Commits

Reviewing files that changed from the base of the PR and between 1313ccd and 148c339.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • src/pages/index.astro

@shrink shrink merged commit fa607e6 into main Mar 17, 2026
9 checks passed
@shrink shrink deleted the sam/add-vercel-analytics branch March 17, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants