Commit 810c883
committed
Add Vercel Web Analytics to Astro
## Vercel Web Analytics Implementation for Astro
Successfully implemented Vercel Web Analytics for the clearcut Astro project.
### Changes Made
#### Files Modified:
1. **src/layouts/Layout.astro**
- Added import: `import Analytics from '@vercel/analytics/astro';`
- Added `<Analytics />` component in the `<head>` section
- Preserves existing code structure and SpeedInsights component
2. **package.json**
- Added dependency: `@vercel/analytics@^1.6.1` (satisfies requirement of v1.4.0 or later)
3. **package-lock.json**
- Updated with new dependency and 440 additional transitive packages
### Implementation Details
- **Package Manager**: npm (project uses package-lock.json)
- **Version Installed**: @vercel/analytics@1.6.1 (meets the v1.4.0+ requirement)
- **Installation Method**: `npm install @vercel/analytics`
- **Component Placement**: Added to the `<head>` section of the base layout as recommended
- **Route Support**: Automatically included via the Astro integration
### Verification
- ✓ Build completed successfully with no errors
- ✓ Package version requirement satisfied (v1.6.1 > v1.4.0)
- ✓ No linting issues (project has no lint scripts configured)
- ✓ No test suite to run (project has no test scripts configured)
- ✓ All lock files updated correctly
- ✓ Existing code structure preserved
### Web Analytics Features
The Analytics component now automatically:
- Tracks page views
- Captures web vitals
- Supports route transitions in Astro
- Sends data to Vercel for analysis
No additional configuration is needed - the component works out of the box alongside the existing SpeedInsights integration.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>1 parent 64a1e34 commit 810c883
3 files changed
+43
-0
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
0 commit comments