Skip to content

Add Vercel Web Analytics integration#14

Draft
vercel[bot] wants to merge 1 commit into
mainfrom
vercel/vercel-web-analytics-integrati-hqfnt2
Draft

Add Vercel Web Analytics integration#14
vercel[bot] wants to merge 1 commit into
mainfrom
vercel/vercel-web-analytics-integrati-hqfnt2

Conversation

@vercel

@vercel vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

Implemented Vercel Web Analytics for the Astro project

Summary

Successfully installed and configured Vercel Web Analytics following the latest official documentation from https://vercel.com/docs/analytics/quickstart.

Changes Made

1. Installed Package

  • Added @vercel/analytics (v2.0.1) to project dependencies
  • Used npm to install the package and update package-lock.json

2. Modified Files

src/components/common/Analytics.astro

  • Added import for VercelAnalytics component from @vercel/analytics/astro
  • Integrated the <VercelAnalytics /> component into the existing Analytics component
  • Preserved existing Google Analytics implementation
  • Added clear comments to separate Vercel Web Analytics from Google Analytics

package.json

  • Added @vercel/analytics as a dependency

package-lock.json

  • Updated to reflect the new dependency

Implementation Details

The implementation follows the official Vercel Analytics documentation for Astro projects:

  • Used the component-based setup (appropriate for static site output)
  • Imported the Astro-specific component from @vercel/analytics/astro
  • Integrated seamlessly with the existing analytics infrastructure
  • The Analytics component is already included in the base Layout.astro, so no additional changes were needed to activate it across all pages

Testing & Verification

✅ Build completed successfully (npm run build)
✅ Astro check passed with no errors related to our changes
✅ ESLint passed with no errors
✅ All 33 pages built successfully
✅ Integration with existing Google Analytics preserved

How It Works

The Vercel Web Analytics component will automatically:

  • Track page views across the entire site
  • Work seamlessly with Astro's client-side routing
  • Send analytics data to Vercel's analytics service when deployed on Vercel
  • Operate independently of the existing Google Analytics setup

No additional configuration is required. The analytics will activate automatically when the site is deployed to Vercel.


View Project · Web Analytics

Created by dongjiang2010-9642 with Vercel Agent

Implemented Vercel Web Analytics for the Astro project

## Summary
Successfully installed and configured Vercel Web Analytics following the latest official documentation from https://vercel.com/docs/analytics/quickstart.

## Changes Made

### 1. Installed Package
- Added `@vercel/analytics` (v2.0.1) to project dependencies
- Used npm to install the package and update package-lock.json

### 2. Modified Files

**src/components/common/Analytics.astro**
- Added import for `VercelAnalytics` component from `@vercel/analytics/astro`
- Integrated the `<VercelAnalytics />` component into the existing Analytics component
- Preserved existing Google Analytics implementation
- Added clear comments to separate Vercel Web Analytics from Google Analytics

**package.json**
- Added `@vercel/analytics` as a dependency

**package-lock.json**
- Updated to reflect the new dependency

## Implementation Details

The implementation follows the official Vercel Analytics documentation for Astro projects:
- Used the component-based setup (appropriate for static site output)
- Imported the Astro-specific component from `@vercel/analytics/astro`
- Integrated seamlessly with the existing analytics infrastructure
- The Analytics component is already included in the base Layout.astro, so no additional changes were needed to activate it across all pages

## Testing & Verification

✅ Build completed successfully (`npm run build`)
✅ Astro check passed with no errors related to our changes
✅ ESLint passed with no errors
✅ All 33 pages built successfully
✅ Integration with existing Google Analytics preserved

## How It Works

The Vercel Web Analytics component will automatically:
- Track page views across the entire site
- Work seamlessly with Astro's client-side routing
- Send analytics data to Vercel's analytics service when deployed on Vercel
- Operate independently of the existing Google Analytics setup

No additional configuration is required. The analytics will activate automatically when the site is deployed to Vercel.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown
Author

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

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Jun 12, 2026 11:15am

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.

0 participants