Install Vercel Web Analytics
Implemented Vercel Web Analytics for Astro Project =================================================== Successfully installed and configured Vercel Web Analytics according to the latest official documentation from https://vercel.com/docs/analytics/quickstart. Changes Made: ------------- 1. **Installed @astrojs/vercel package** (v11.0.9) - Added to dependencies in package.json - Updated package-lock.json with new dependencies 2. **Modified astro.config.mjs** - Imported the Vercel adapter: `import vercel from '@astrojs/vercel'` - Added adapter configuration with Web Analytics enabled: ```javascript adapter: vercel({ webAnalytics: { enabled: true }, }) ``` Implementation Details: ---------------------- For Astro projects, Vercel Web Analytics is enabled through the Vercel adapter configuration rather than installing a separate analytics package. This is the framework-specific approach documented in the official Vercel quickstart guide. The configuration enables Web Analytics by: - Setting up the Vercel adapter as the deployment target - Enabling the webAnalytics option in the adapter configuration - This automatically injects the necessary analytics tracking when the site is deployed to Vercel Verification: ------------- ✓ Build completed successfully (npm run build) ✓ All static routes generated without errors ✓ Vercel adapter correctly configured and working ✓ No linting errors (no linter configured in this project) ✓ No test failures (no tests configured in this project) Files Modified: -------------- - astro.config.mjs - Added Vercel adapter with Web Analytics enabled - package.json - Added @astrojs/vercel dependency - package-lock.json - Updated with new dependency tree Next Steps: ----------- Once deployed to Vercel, Web Analytics will automatically start tracking: - Page views - User sessions - Performance metrics The analytics data will be visible in the Vercel dashboard under the Analytics section after deployment and user visits. Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
This commit is contained in:
parent
9621a08c6d
commit
86869a5b42
3 changed files with 811 additions and 126 deletions
|
|
@ -4,6 +4,7 @@ import { defineConfig } from 'astro/config';
|
||||||
import react from '@astrojs/react';
|
import react from '@astrojs/react';
|
||||||
import mdx from '@astrojs/mdx';
|
import mdx from '@astrojs/mdx';
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
|
import vercel from '@astrojs/vercel';
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|
@ -19,6 +20,10 @@ export default defineConfig({
|
||||||
|
|
||||||
integrations: [react(), mdx()],
|
integrations: [react(), mdx()],
|
||||||
|
|
||||||
|
adapter: vercel({
|
||||||
|
webAnalytics: { enabled: true },
|
||||||
|
}),
|
||||||
|
|
||||||
vite: {
|
vite: {
|
||||||
plugins: [tailwindcss()],
|
plugins: [tailwindcss()],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
931
package-lock.json
generated
931
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -15,6 +15,7 @@
|
||||||
"@astrojs/markdown-satteri": "^0.4.0",
|
"@astrojs/markdown-satteri": "^0.4.0",
|
||||||
"@astrojs/mdx": "^8.0.0",
|
"@astrojs/mdx": "^8.0.0",
|
||||||
"@astrojs/react": "^6.0.5",
|
"@astrojs/react": "^6.0.5",
|
||||||
|
"@astrojs/vercel": "^11.0.9",
|
||||||
"@tailwindcss/vite": "^4.3.3",
|
"@tailwindcss/vite": "^4.3.3",
|
||||||
"@types/react": "^19.2.18",
|
"@types/react": "^19.2.18",
|
||||||
"@types/react-dom": "^19.2.5",
|
"@types/react-dom": "^19.2.5",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue