Home
cd ../playbooks
Developer ToolsBeginner

Vercel Analytics & Speed Insights Setup

Wire up Vercel Analytics, Speed Insights, and SPA routing rewrites into a React/Vite project in one pass — including the routing fix most people miss.

5 minutes
By Kanaeru LabsSource
#vercel#analytics#speed-insights#react#vite#spa-routing#monitoring

You add Vercel Analytics, check the dashboard a week later, and it's empty. The package installed fine — you just imported from the wrong entry point, and nothing told you.

Who it's for: React and Vite developers deploying to Vercel, indie hackers wanting traffic data without a heavier analytics stack, solo founders setting up a new SPA, developers debugging a 404-on-refresh bug in production

Example

"Set up Vercel Analytics for this Vite app" → @vercel/analytics and @vercel/speed-insights installed, both components mounted with the correct /react imports, a vercel.json rewrite rule added so direct route navigation stops 404ing, and a verification pass confirming both actually render

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

Or install from your terminal:
npx ccplaybooks add vercel-analytics-setup
# Vercel Analytics & Speed Insights Setup

## Your Role

Wire up Vercel Analytics and Speed Insights into a React/Vite project, and fix the SPA routing gap that causes direct-navigation 404s on Vercel. One-shot setup, not an ongoing workflow.

---

## Tasks

### 1. Install the packages

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

A one-shot setup task for React/Vite projects deploying to Vercel: installs Analytics and Speed Insights, mounts them correctly, and fixes the SPA routing gap that causes 404s when someone refreshes on a non-root route — a bug that only shows up in production, never in local dev.


Quick Start

Step 1: Navigate to Your Project

cd ~/your-vite-project

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Run the Setup

claude

Then ask: "Set up Vercel Analytics and Speed Insights"


What Gets Configured

Component Purpose
@vercel/analytics Page view and visitor tracking
@vercel/speed-insights Core Web Vitals monitoring
vercel.json rewrite rule Serves index.html for all routes, fixing direct-navigation 404s

Tips & Best Practices

  • Import from /react, not /next. The two entry points look nearly identical and neither errors if you pick wrong — the wrong one just silently collects nothing. If the Vercel dashboard stays empty after a deploy, check this first.
  • Test routing with a direct URL hit, not in-app navigation. Vite's dev server already handles client-side routing correctly, so the missing-rewrite bug never shows up locally. Only a hard refresh or a shared link on a nested route — after deploying — will surface it.
  • This is a five-minute task, not an ongoing workflow. It doesn't set up custom event tracking, alerting, or dashboard configuration — just the two packages and the routing fix.

Limitations

  • Scoped to React/Vite projects specifically — Next.js apps use different Vercel Analytics import paths and don't need the vercel.json rewrite (Next.js handles SPA-style routing server-side already)
  • Doesn't cover custom event tracking or alerting — only the base pageview/vitals setup

$Related Playbooks

Developer Tools

Shannon: Autonomous Pentesting for Your Own Apps

An operating guide for driving Keygraph's Shannon CLI: scope a white-box pentest against an app you own, run it, and turn the proven findings into fix tasks

15 minutes
Advanced
Developer Tools

Unslop UI Skill for Claude: Kill the AI Design Tells

A frontend guardrail built from a 3.2M-post Reddit analysis of what people actually call AI slop, with a build mode that forces design decisions up front and an audit mode that scans existing code for the tells

10 minutes
Intermediate
Developer Tools

Redesign Existing Projects: UI Audit and Upgrade

A design audit checklist that finds generic AI-look patterns in an existing codebase and fixes them without breaking functionality or migrating frameworks

10 minutes
Intermediate
Developer Tools

Soft UI Design Skill: Premium, Awwwards-Tier Interfaces

A design system that makes Claude build $150k-agency-feeling UI — double-bezel cards, spring-physics motion, magnetic buttons, and a banned list that blocks every cheap AI-design tell

5 minutes
Intermediate
Developer Tools

Stitch Design Taste: Semantic DESIGN.md Generator for Google Stitch

Generates a DESIGN.md that encodes premium, anti-generic design rules in Google Stitch's natural-language format — color, type, layout, motion intent, and a full banned-pattern list

5 minutes
Intermediate
Developer Tools

Prompt Optimizer (EARS)

Transform vague prompts into precise, well-structured specifications using EARS (Easy Approach to Requirements Syntax) — ideal for AI-generated code, products, and docs.

10 minutes
Intermediate
Developer Tools

Promptfoo Evaluation

Configure and run LLM evaluations with Promptfoo — build promptfooconfig.yaml, write Python custom assertions, implement llm-rubric judges, and compare models systematically.

15 minutes
Intermediate
Developer Tools

Repomix Safe Mixer

Package codebases with repomix while automatically detecting and removing hardcoded credentials before packing — so you never leak secrets when sharing code.

5 minutes
Beginner
Developer Tools

Repomix Unmixer

Extract files from repomix-packed repositories — restore the original directory structure from XML, Markdown, or JSON output, reversing the packing process.

5 minutes
Beginner
Developer Tools

Scrapling Web Extractor

Install, troubleshoot, and use the Scrapling CLI to extract HTML, Markdown, or text from webpages — including browser-backed fetching and tricky sources like WeChat articles.

10 minutes
Beginner
Developer Tools

Statusline Generator

Install, configure, customize, or troubleshoot the Claude Code statusline — cwd, model, token counts, cost via ccusage, git status — and fix a statusline that's blank, stuck, or silent.

10 minutes
Beginner
Developer Tools

Tunnel Doctor

Diagnose and fix conflicts between Tailscale and proxy/VPN tools on macOS — route hijacking, proxy env vars, SSH double-tunneling, and the ~60s DNS resolver stall.

15 minutes
Advanced

Browse all Developer Tools playbooks →