Vercel Analytics
Set up Vercel Analytics and Speed Insights for React/Vite projects
$ npx claude-code-templates@latest --command="setup/vercel-analytics" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
Vercel Analytics Setup
Automatically configure Vercel Analytics and Speed Insights for your React/Vite project.
Usage:/vercel-analytics (no arguments needed)
What it does:
- Installs @vercel/analytics and @vercel/speed-insights packages
- Adds components to your React app
- Configures SPA routing for Vercel deployment
- Fixes 404 errors for direct route access
- Install Vercel Packages
npm install @vercel/analytics @vercel/speed-insights
- Detect Main App File
- src/App.tsx or src/App.jsx
- src/main.tsx or src/main.jsx
- Read file to determine current structure
- Add Analytics Components
- Import SpeedInsights from '@vercel/speed-insights/react'
- Add both components to the main App component
- Use /react imports (not /next)
- Create vercel.json Configuration
vercel.json in project root
- Add SPA rewrite rules:
{
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]
}
- This ensures all routes serve index.html (fixes 404s)
- Verify Setup
- Check vercel.json exists and is valid
- Display success message with next steps
Expected Outcome:- ✅ Analytics tracking active
- ✅ Speed Insights monitoring configured
- ✅ SPA routing works correctly on Vercel
- ✅ No 404 errors on direct route access
- Deploy to Vercel:
vercel deploy - View analytics at: https://vercel.com/dashboard/analytics
- Check Speed Insights: https://vercel.com/dashboard/speed-insights
Related Claude Code Commands
Design Database Schema
Design optimized database schemas with proper relationships, constraints, and performance considerations
Setup Docker Containers
Setup Docker containerization with multi-stage builds and development workflows
Setup Development Environment
Setup comprehensive development environment with tools, configurations, and workflows
Setup Linting
Configure comprehensive code linting and quality analysis tools with automated enforcement
Design Rest Api
Design RESTful API architecture with comprehensive endpoints, authentication, and documentation
Create Database Migrations
Create and manage database migrations with proper versioning and rollback support
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.