Skip to content

Commit 1d26d99

Browse files
committed
Set up Vercel Speed Insights for your project
# Vercel Speed Insights Implementation ## Summary Successfully implemented Vercel Speed Insights for the gifts-couple-connection React + Vite project. ## Changes Made ### 1. Package Installation - Added `@vercel/speed-insights` (v1.3.1) as a dependency in package.json - Updated package-lock.json with the new dependency and its sub-dependencies ### 2. Component Integration - Modified `App.tsx` to import the `SpeedInsights` component from `@vercel/speed-insights/react` - Added the `<SpeedInsights />` component to the main App component, placed alongside the existing `<Analytics />` component within the ToastProvider - This ensures Speed Insights tracking is active across all pages of the application ### Files Modified - `App.tsx` - Added SpeedInsights import and component - `package.json` - Added @vercel/speed-insights dependency - `package-lock.json` - Updated with new dependency tree ## Implementation Details The SpeedInsights component was added to the root App component, following the same pattern as the existing Analytics integration. This placement ensures that: - Speed Insights is initialized once when the app loads - Performance metrics are tracked across all routes and views - The implementation is consistent with the project's existing Vercel integration pattern ## Verification - Build completed successfully with no errors - All TypeScript types resolved correctly - The component integrates seamlessly with the existing React structure ## Next Steps for Deployment Once deployed to Vercel: 1. Enable Speed Insights in the Vercel dashboard for this project 2. The tracking script at `/_vercel/speed-insights/script.js` will be automatically available 3. Performance metrics will begin appearing in the Speed Insights dashboard after user visits 4. Monitor Core Web Vitals and other performance metrics through the Vercel dashboard ## Notes - The project uses React 19.2.4 with Vite 6.2.0 - Speed Insights component is from the official `@vercel/speed-insights` package - Implementation follows Vercel's recommended approach for React applications - The component is placed at the app root level for optimal tracking coverage Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
1 parent 8e30394 commit 1d26d99

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import { Analytics } from '@vercel/analytics/react';
3+
import { SpeedInsights } from '@vercel/speed-insights/react';
34
import { Layout } from './components/Layout';
45
import { BottomNav } from './components/BottomNav';
56
import { LandingPage } from './pages/Landing';
@@ -111,6 +112,7 @@ const App: React.FC = () => {
111112
<ToastProvider>
112113
<AppContent />
113114
<Analytics />
115+
<SpeedInsights />
114116
</ToastProvider>
115117
</AuthProvider>
116118
</AppProvider>

package-lock.json

Lines changed: 35 additions & 0 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
@@ -28,6 +28,7 @@
2828
"@capacitor/core": "^8.1.0",
2929
"@supabase/supabase-js": "^2.95.3",
3030
"@vercel/analytics": "^1.6.1",
31+
"@vercel/speed-insights": "^1.3.1",
3132
"bcryptjs": "^3.0.3",
3233
"compression": "^1.8.1",
3334
"concurrently": "^9.2.1",

0 commit comments

Comments
 (0)