/skills:analyticsfrom skills
Setup Vercel Analytics for Next.js applications with custom event tracking. Use this skill when the user says "setup analytics", "add analytics", "setup vercel analytics", "track events", or "add tracking".
Ships in skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Complete setup for Vercel Analytics in Next.js applications with custom event tracking for both client and server.
| Skill File | Target Project Path | Description |
|---|---|---|
| (embedded) | src/app/layout.tsx | Analytics component added |
| (embedded) | src/components/*.tsx | Event tracking examples |
bun add @vercel/analytics
Add the Analytics component to your root layout:
// app/layout.tsx
import { Analytics } from "@vercel/analytics/next";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
{children}
<Analytics />
</body>
</html>
);
}
Analytics auto-detects after your next deployment.
import { track } from "@vercel/analytics";
// Basic event
track("Signup");
// Event with data
track("Purchase", {
product: "shirt",
price: 25,
});
Use in Server Actions or Route Handlers:
import { track } from "@vercel/analytics/server";
// In Server Action or Route Handler
await track("FormSubmit", { type: "contact" });
| Prop | Type | Description |
|---|---|---|
mode | 'auto' | 'production' | 'development' | When to track. Default: 'auto' |
debug | boolean | Log events to console |
beforeSend | (event) => event | null | Modify/filter events |
Filter or modify events before sending:
<Analytics
beforeSend={(event) => {
// Redact sensitive paths
if (event.url.includes("/private")) {
return { ...event, url: "/private/[redacted]" };
}
// Skip tracking entirely
if (event.url.includes("/admin")) {
return null;
}
return event;
}}
/>
| Constraint | Limit |
|---|---|
| Event name | max 255 chars |
| Property key | max 255 chars |
| Property value | max 255 chars |
| Nested objects | Not supported |
| Value types | string | number | boolean | null |
| Custom events | Pro/Enterprise plans only |
In development mode, Analytics loads but does NOT send requests to Vercel servers. Instead:
va.vercel-scripts.com/v1/script.debug.js loading successfully[Vercel Web Analytics] Debug mode is enabled by default in development. No requests will be sent to the server.[Vercel Web Analytics] Running queued event pageview {"route":"/","path":"/"}[Vercel Web Analytics] [pageview] http://localhost:3000/ {...}The console messages confirm Analytics is properly initialized and tracking pageviews, even though data isn't sent in dev mode.
After deployment to Vercel:
/_vercel/insights/view (pageviews)/_vercel/insights/event (custom events)va.vercel-scripts.com endpoints| Issue | Solution |
|---|---|
| No network requests in dev | Expected behavior - debug mode logs to console only |
| No console messages | Verify <Analytics /> is in root layout and page refreshed |
| Script fails to load | Check for ad blockers or network issues |
| No data in dashboard | Ensure Analytics is enabled in Vercel Dashboard and site is deployed |
// Check Analytics script loaded
const analyticsScript = await page.waitForResponse(
(response) => response.url().includes("va.vercel-scripts.com") && response.status() === 200
);
// Check console for Analytics messages (development)
page.on("console", (msg) => {
if (msg.text().includes("[Vercel Web Analytics]")) {
console.log("Analytics initialized:", msg.text());
}
});
"use client";
import { track } from "@vercel/analytics";
export function CTAButton() {
return (
<button
onClick={() => {
track("CTA Clicked", { location: "hero" });
}}
>
Get Started
</button>
);
}
"use client";
import { track } from "@vercel/analytics";
export function ContactForm() {
async function handleSubmit(formData: FormData) {
track("Form Submitted", {
type: "contact",
hasMessage: Boolean(formData.get("message")),
});
// Submit form...
}
return <form action={handleSubmit}>{/* fields */}</form>;
}
// app/api/checkout/route.ts
import { track } from "@vercel/analytics/server";
import { NextResponse } from "next/server";
export async function POST(request: Request) {
const { items, total } = await request.json();
await track("Checkout Started", {
itemCount: items.length,
total,
});
// Process checkout...
return NextResponse.json({ success: true });
}
// app/actions.ts
"use server";
import { track } from "@vercel/analytics/server";
export async function subscribeToNewsletter(email: string) {
await track("Newsletter Signup", { source: "footer" });
// Save to database...
}
@vercel/analytics installed<Analytics /> component added to root layoutWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub mattwoodco/skills --plugin skills84 skills in this plugin
/add-featureParent skill for feature and project workflows. Use when the user wants to build a project, add a feature, polish a skill, test all skills, or browse the skill catalog. Routes to add-project (build project from idea), improve-skill (refine one skill in a sandbox), test-skills (validate full skill composition), or any child skill by name.
/add-projectEnd-to-end project builder: idea → spec → shell → ralph loop → secrets → report. SMS notification after every phase. Creates a project directory with symlinked skills and a ralph execution loop. Does NOT scaffold Next.js — ralph does that as step 1.1 of the plan. Use when the user says "build project", "build a project", "new project", "create project", "build from idea", "scaffold and notify", "spec a project", "plan a project", or "scaffold project".
/add-pwaSetup Progressive Web App (PWA) support for a Next.js project using Serwist. Use when user says "setup pwa", "add pwa", "make it a pwa", "progressive web app", or "enable offline support"./add-seoSetup comprehensive SEO for a Next.js project using built-in metadata APIs. Use when user says "setup seo", "add seo", "configure metadata", "add sitemap", "add open graph", or "improve seo"./add-shadcnSetup a design system using shadcn/ui. Use this skill when the user says "setup design system", "set up design system", "create design system", "setup shadcn", or "initialize design system"./add-specCreate a project spec from an idea using the full brainstorming design workflow, then output a no-frills spec for Ralph loops and add-project. Use when the user says "spec a project", "create a spec", "spec this idea", "plan a project", "write a spec", or when add-project delegates Phase 1 spec generation. Runs brainstorming first (clarify → approaches → design approval → design doc), then writes docs/specs/{name}.md with mission, features, flows, screens, and skills mapping.