Skip to content

Enable Vercel Web Analytics script injection#1

Merged
finallyjay merged 1 commit into
mainfrom
enable-vercel-web-analytics
Jun 3, 2026
Merged

Enable Vercel Web Analytics script injection#1
finallyjay merged 1 commit into
mainfrom
enable-vercel-web-analytics

Conversation

@finallyjay
Copy link
Copy Markdown
Owner

Problem

Web Analytics was enabled in the Vercel dashboard, but the app never rendered the tracking script — so no data was being collected (the dashboard would stay empty).

Verified before the fix: no webAnalytics option in astro.config.mjs, no <Analytics /> component, and /_vercel/insights/script.js was absent from the build output.

Fix

Enable the @astrojs/vercel adapter's built-in webAnalytics option, which injects the tracking script in production builds.

adapter: vercel({
  webAnalytics: { enabled: true },
}),

Verification

  • npm run build completes successfully.
  • The server bundle now contains /_vercel/insights/script.js and window.va (confirmed via grep of .vercel/output), which were absent before.

🤖 Generated with Claude Code

The dashboard had Web Analytics turned on, but the app never rendered the
tracking script, so no data was collected. Enable the adapter's built-in
webAnalytics option to inject /_vercel/insights/script.js in production.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 3, 2026 09:47
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

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

Project Deployment Actions Updated (UTC)
daily-dev-roulette Ready Ready Preview, Comment Jun 3, 2026 9:47am

@finallyjay finallyjay merged commit 63e8fa8 into main Jun 3, 2026
3 checks passed
@finallyjay finallyjay deleted the enable-vercel-web-analytics branch June 3, 2026 09:47
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

Enables Vercel Web Analytics script injection via the @astrojs/vercel adapter configuration so production deployments emit the tracking script (fixing the empty analytics dashboard issue).

Changes:

  • Configure the Vercel adapter with webAnalytics: { enabled: true } in astro.config.mjs.
  • Add an inline comment describing the intent of the adapter option.

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

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