Skip to content

Commit 286c9c2

Browse files
committed
Enable Vercel Speed Insights on your project
# Implementation Report: Vercel Speed Insights Integration ## Summary Successfully integrated Vercel Speed Insights into the React + Vite application to enable performance monitoring and tracking. ## Changes Made ### 1. Installed Dependencies - Added `@vercel/speed-insights` package (version 1.3.1) - Updated package.json and package-lock.json with the new dependency ### 2. Modified App.tsx Added Speed Insights tracking to the main application component: - Imported `SpeedInsights` component from `@vercel/speed-insights/react` - Added `<SpeedInsights />` component inside the App component, placed within the provider hierarchy after AppContent for proper tracking ### Implementation Details The SpeedInsights component was strategically placed inside the ToastProvider wrapper (at the root level of the component tree) to ensure: - It has access to all necessary providers - It can track all pages and routes in the application - It follows React best practices for third-party analytics integrations ## Files Modified - `/App.tsx` - Added Speed Insights component import and rendered component - `/package.json` - Added @vercel/speed-insights dependency - `/package-lock.json` - Updated with new dependency resolution ## Testing - Build verification: ✅ Successfully completed with `npm run build` - No build errors or warnings introduced - Application structure preserved with minimal, focused changes ## Next Steps After deployment to Vercel: 1. Enable Speed Insights in the Vercel dashboard for this project 2. Verify the script is injected at `/_vercel/speed-insights/script.js` 3. Monitor performance metrics in the Speed Insights dashboard ## Implementation Approach Followed the official Vercel Speed Insights documentation for React applications, using the appropriate package import path (`@vercel/speed-insights/react`) for this Vite + React setup. Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
1 parent ad2f491 commit 286c9c2

3 files changed

Lines changed: 38 additions & 7 deletions

File tree

App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useEffect, useState } from 'react';
2+
import { SpeedInsights } from '@vercel/speed-insights/react';
23
import { Layout } from './components/Layout';
34
import { BottomNav } from './components/BottomNav';
45
import { LandingPage } from './pages/Landing';
@@ -109,6 +110,7 @@ const App: React.FC = () => {
109110
<AuthProvider>
110111
<ToastProvider>
111112
<AppContent />
113+
<SpeedInsights />
112114
</ToastProvider>
113115
</AuthProvider>
114116
</AppProvider>

package-lock.json

Lines changed: 35 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
},
1717
"dependencies": {
1818
"@supabase/supabase-js": "^2.95.3",
19+
"@vercel/speed-insights": "^1.3.1",
1920
"bcryptjs": "^3.0.3",
2021
"compression": "^1.8.1",
2122
"concurrently": "^9.2.1",

0 commit comments

Comments
 (0)