Install Vercel Web Analytics integration - #1
Open
vercel[bot] wants to merge 2 commits into
Open
Conversation
## Vercel Web Analytics Implementation
Successfully installed and configured Vercel Web Analytics for this Astro project.
### Changes Made
**Modified Files:**
1. `astro.config.mjs` - Added Vercel adapter with Web Analytics enabled
2. `package.json` - Added dependencies for @astrojs/vercel and @vercel/analytics
3. `package-lock.json` - Updated lock file with new dependencies
### Implementation Details
**Packages Installed:**
- `@astrojs/vercel@^10.0.8` - Official Astro adapter for Vercel deployment
- `@vercel/analytics@^2.0.1` - Vercel Web Analytics package
**Configuration:**
Updated `astro.config.mjs` to import and configure the Vercel adapter with Web Analytics:
```javascript
import vercel from "@astrojs/vercel";
export default defineConfig({
// ... existing config
adapter: vercel({
webAnalytics: {
enabled: true,
},
}),
});
```
### Implementation Approach
Following the official Vercel Analytics documentation (fetched on 2026-05-28), the implementation uses the Astro-specific configuration method. For Astro static sites, the Vercel adapter automatically injects the Web Analytics tracking scripts across all pages when `webAnalytics.enabled` is set to true.
This approach is recommended for Astro projects as it:
- Automatically handles script injection without manual component placement
- Works seamlessly with both static and server-rendered Astro sites
- Requires no additional code changes to existing pages or layouts
- Integrates natively with Vercel's deployment platform
### Verification
✅ Build completed successfully with no errors
✅ Dependencies installed and lock file updated
✅ Configuration validated
### Next Steps
When deployed to Vercel:
1. The Web Analytics will automatically start collecting page view data
2. You can view analytics in the Vercel dashboard under the Analytics tab
3. No additional configuration is needed in the Vercel dashboard
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Author
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
farhat60
marked this pull request as ready for review
May 28, 2026 19:29
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.
Vercel Web Analytics Implementation
Successfully installed and configured Vercel Web Analytics for this Astro project.
Changes Made
Modified Files:
astro.config.mjs- Added Vercel adapter with Web Analytics enabledpackage.json- Added dependencies for @astrojs/vercel and @vercel/analyticspackage-lock.json- Updated lock file with new dependenciesImplementation Details
Packages Installed:
@astrojs/vercel@^10.0.8- Official Astro adapter for Vercel deployment@vercel/analytics@^2.0.1- Vercel Web Analytics packageConfiguration:
Updated
astro.config.mjsto import and configure the Vercel adapter with Web Analytics:Implementation Approach
Following the official Vercel Analytics documentation (fetched on 2026-05-28), the implementation uses the Astro-specific configuration method. For Astro static sites, the Vercel adapter automatically injects the Web Analytics tracking scripts across all pages when
webAnalytics.enabledis set to true.This approach is recommended for Astro projects as it:
Verification
✅ Build completed successfully with no errors
✅ Dependencies installed and lock file updated
✅ Configuration validated
Next Steps
When deployed to Vercel:
View Project · Web Analytics
Created by abdullahfarhat60-7937 with Vercel Agent