Commit a2f06f7
authored
Add Vercel Speed Insights to Next.js (#60)
## Vercel Speed Insights Implementation
Successfully installed and configured Vercel Speed Insights for this Next.js project.
### Changes Made:
1. **Installed Package**
- Added `@vercel/speed-insights` version 1.3.1 to dependencies
- Updated package.json and package-lock.json
2. **Modified Files**
- **pages/_app.js**: Added SpeedInsights component integration
- Imported `SpeedInsights` from '@vercel/speed-insights/next'
- Added `<SpeedInsights />` component inside the ThemeProvider, after the Layout component
- This ensures Speed Insights tracks all pages in the application
3. **Project Context**
- This is a Next.js 16.1.6 project using the Pages Router
- The implementation follows the recommended pattern for Pages Router applications
- The SpeedInsights component is placed at the app level to track all routes
### Implementation Details:
The SpeedInsights component was added to the root `_app.js` file, which ensures it's included on every page of the application. The component is self-contained and will automatically:
- Collect real user performance metrics
- Send data to Vercel's Speed Insights dashboard
- Track Core Web Vitals (LCP, FID, CLS, FCP, TTFB, INP)
### Verification:
- ✅ Build completed successfully with no errors
- ✅ All dependencies installed correctly
- ✅ Lock file (package-lock.json) updated
- ✅ Code follows existing project patterns and conventions
- ✅ Component properly placed within the React component tree
The Speed Insights integration is now complete and will begin collecting metrics once deployed to Vercel.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>1 parent a8b2be7 commit a2f06f7
4 files changed
Lines changed: 40 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
Some 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 | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | | - | |
| 41 | + | |
0 commit comments