Skip to content

Enable Vercel Speed Insights for your project#2

Draft
vercel[bot] wants to merge 1 commit into
masterfrom
vercel/enable-vercel-speed-insights-f-15w6kl
Draft

Enable Vercel Speed Insights for your project#2
vercel[bot] wants to merge 1 commit into
masterfrom
vercel/enable-vercel-speed-insights-f-15w6kl

Conversation

@vercel

@vercel vercel Bot commented Mar 10, 2026

Copy link
Copy Markdown

Vercel Speed Insights Implementation

Summary

Successfully implemented Vercel Speed Insights following the official documentation for vanilla TypeScript/JavaScript projects.

Changes Made

1. Package Installation

  • Added @vercel/speed-insights version ^2.0.0 to project dependencies
  • Updated package.json with the new dependency
  • Regenerated package-lock.json with the new package and its dependencies

2. Code Integration (src/main.ts)

  • Imported injectSpeedInsights function from @vercel/speed-insights
  • Added injectSpeedInsights() call after the existing Vercel Analytics injection
  • This ensures Speed Insights tracking is initialized when the application loads

3. Implementation Details

The implementation follows the "other" framework pattern from the Vercel Speed Insights documentation since this is a Vite + TypeScript project:

  • Used injectSpeedInsights() function which adds the tracking script to the app
  • Function is called only once in the main entry point (src/main.ts)
  • Runs on the client side as required

4. Build Verification

  • Successfully built the project using npm run build
  • Verified TypeScript compilation passes without errors
  • Confirmed Speed Insights code is properly bundled in the output
  • Build output: 13.49 kB JavaScript bundle with Speed Insights included

Files Modified

  • package.json - Added @vercel/speed-insights dependency
  • package-lock.json - Updated with new dependency tree
  • yarn.lock - Updated with new dependency (project has both npm and yarn locks)
  • src/main.ts - Added import and initialization call for Speed Insights

Next Steps

After deployment to Vercel:

  1. The Speed Insights routes (/_vercel/speed-insights/*) will be automatically available
  2. Performance metrics will start being collected from user visits
  3. Data will be viewable in the Vercel Dashboard under the Speed Insights tab

Notes

  • Speed Insights works alongside the existing Vercel Analytics implementation
  • Both analytics and speed insights are now properly configured
  • The implementation is production-ready and follows Vercel's best practices

View Project · Speed Insights

Created by typeclecio with Vercel Agent

# Vercel Speed Insights Implementation

## Summary
Successfully implemented Vercel Speed Insights following the official documentation for vanilla TypeScript/JavaScript projects.

## Changes Made

### 1. Package Installation
- Added `@vercel/speed-insights` version ^2.0.0 to project dependencies
- Updated package.json with the new dependency
- Regenerated package-lock.json with the new package and its dependencies

### 2. Code Integration (src/main.ts)
- Imported `injectSpeedInsights` function from `@vercel/speed-insights`
- Added `injectSpeedInsights()` call after the existing Vercel Analytics injection
- This ensures Speed Insights tracking is initialized when the application loads

### 3. Implementation Details
The implementation follows the "other" framework pattern from the Vercel Speed Insights documentation since this is a Vite + TypeScript project:
- Used `injectSpeedInsights()` function which adds the tracking script to the app
- Function is called only once in the main entry point (src/main.ts)
- Runs on the client side as required

### 4. Build Verification
- Successfully built the project using `npm run build`
- Verified TypeScript compilation passes without errors
- Confirmed Speed Insights code is properly bundled in the output
- Build output: 13.49 kB JavaScript bundle with Speed Insights included

## Files Modified
- `package.json` - Added @vercel/speed-insights dependency
- `package-lock.json` - Updated with new dependency tree
- `yarn.lock` - Updated with new dependency (project has both npm and yarn locks)
- `src/main.ts` - Added import and initialization call for Speed Insights

## Next Steps
After deployment to Vercel:
1. The Speed Insights routes (`/_vercel/speed-insights/*`) will be automatically available
2. Performance metrics will start being collected from user visits
3. Data will be viewable in the Vercel Dashboard under the Speed Insights tab

## Notes
- Speed Insights works alongside the existing Vercel Analytics implementation
- Both analytics and speed insights are now properly configured
- The implementation is production-ready and follows Vercel's best practices

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

vercel Bot commented Mar 10, 2026

Copy link
Copy Markdown
Author

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

Project Deployment Actions Updated (UTC)
setupvalido Ready Ready Preview, Comment Mar 10, 2026 8:32pm

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