Skip to content

Conversation

@vercel
Copy link

@vercel vercel bot commented Dec 22, 2025

Vercel Speed Insights Integration for Astro

Successfully installed and configured Vercel Speed Insights for the Astro blog project.

Changes Made

1. Installed Package

  • Added @vercel/speed-insights (v1.3.1) to dependencies using pnpm install @vercel/speed-insights
  • Updated package.json and pnpm-lock.yaml with the new dependency

2. Modified Files

  • src/layouts/Layout.astro:
    • Added import statement: import SpeedInsights from "@vercel/speed-insights/astro"
    • Added the <SpeedInsights /> component near the bottom of the body element, right before the closing </body> tag
    • This ensures the Speed Insights tracking is included on all pages that use the Layout component

Implementation Details

The SpeedInsights component is placed in the main Layout component to ensure:

  • ✓ Works on both static and SSR Astro apps
  • ✓ Tracks performance metrics across all pages
  • ✓ Minimal performance impact due to optimal placement before closing body tag
  • ✓ Compatible with the existing page structure and Swup integration

Verification

✓ Build completed successfully (npm run build)
✓ Linter passed with no issues (npm run lint)
✓ All dependencies properly installed and locked
✓ No breaking changes to existing functionality

Notes

The SpeedInsights component uses a default export from @vercel/speed-insights/astro, which is why it's imported as import SpeedInsights rather than using destructuring. The component automatically:

  • Detects the Astro framework
  • Collects Web Vitals metrics
  • Reports them to Vercel's analytics infrastructure
  • Works without any additional configuration

View Project · Speed Insights

Created by kairo0916 with Vercel Agent

## Vercel Speed Insights Integration for Astro

Successfully installed and configured Vercel Speed Insights for the Astro blog project.

### Changes Made

#### 1. Installed Package
- Added `@vercel/speed-insights` (v1.3.1) to dependencies using `pnpm install @vercel/speed-insights`
- Updated `package.json` and `pnpm-lock.yaml` with the new dependency

#### 2. Modified Files
- **src/layouts/Layout.astro**: 
  - Added import statement: `import SpeedInsights from "@vercel/speed-insights/astro"`
  - Added the `<SpeedInsights />` component near the bottom of the body element, right before the closing `</body>` tag
  - This ensures the Speed Insights tracking is included on all pages that use the Layout component

### Implementation Details

The SpeedInsights component is placed in the main Layout component to ensure:
- ✓ Works on both static and SSR Astro apps
- ✓ Tracks performance metrics across all pages
- ✓ Minimal performance impact due to optimal placement before closing body tag
- ✓ Compatible with the existing page structure and Swup integration

### Verification

✓ Build completed successfully (`npm run build`)
✓ Linter passed with no issues (`npm run lint`)
✓ All dependencies properly installed and locked
✓ No breaking changes to existing functionality

### Notes

The SpeedInsights component uses a default export from `@vercel/speed-insights/astro`, which is why it's imported as `import SpeedInsights` rather than using destructuring. The component automatically:
- Detects the Astro framework
- Collects Web Vitals metrics
- Reports them to Vercel's analytics infrastructure
- Works without any additional configuration

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

vercel bot commented Dec 22, 2025

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

Project Deployment Review Updated (UTC)
blog-kairo Canceled Canceled Dec 22, 2025 3:22pm

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