Implements privacy-friendly web analytics with Vercel Analytics for traffic insights and Web Vitals. Use when tracking page views and performance metrics in Next.js applications deployed on Vercel.
Adds privacy-friendly analytics to Next.js apps deployed on Vercel. Use when you need to track page views, custom events, or Core Web Vitals without cookies.
/plugin marketplace add mgd34msu/goodvibes-plugin/plugin install goodvibes@goodvibes-marketThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Privacy-friendly, real-time traffic insights and Web Vitals for Vercel-deployed applications. Zero configuration with automatic Core Web Vitals tracking.
npm install @vercel/analytics
// app/layout.tsx
import { Analytics } from '@vercel/analytics/react';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Analytics />
</body>
</html>
);
}
// pages/_app.tsx
import { Analytics } from '@vercel/analytics/react';
import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return (
<>
<Component {...pageProps} />
<Analytics />
</>
);
}
import { Analytics } from '@vercel/analytics/react';
<Analytics
mode="production" // 'production' | 'development' | 'auto'
debug={false} // Enable debug mode
beforeSend={(event) => {
// Modify or filter events before sending
if (event.url.includes('/private')) {
return null; // Don't track
}
return event;
}}
/>
Track custom events beyond page views.
import { track } from '@vercel/analytics';
// Basic event
track('signup_clicked');
// Event with properties
track('item_purchased', {
productId: 'prod_123',
price: 29.99,
currency: 'USD',
});
// Form submission
function ContactForm() {
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
track('contact_form_submitted', {
source: 'footer',
});
// Submit form...
};
return <form onSubmit={handleSubmit}>...</form>;
}
// app/api/checkout/route.ts
import { track } from '@vercel/analytics/server';
import { NextRequest, NextResponse } from 'next/server';
export async function POST(request: NextRequest) {
const { orderId, amount } = await request.json();
await track('purchase_completed', {
orderId,
amount,
});
return NextResponse.json({ success: true });
}
Track Core Web Vitals with Vercel Speed Insights.
npm install @vercel/speed-insights
// app/layout.tsx
import { Analytics } from '@vercel/analytics/react';
import { SpeedInsights } from '@vercel/speed-insights/next';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Analytics />
<SpeedInsights />
</body>
</html>
);
}
// app/layout.tsx
'use client';
import { useReportWebVitals } from 'next/web-vitals';
export function WebVitals() {
useReportWebVitals((metric) => {
console.log(metric);
// {
// id: 'v3-1234567890',
// name: 'LCP',
// value: 2500,
// rating: 'good',
// delta: 2500,
// entries: [...],
// navigationType: 'navigate',
// }
// Send to your analytics
// gtag('event', metric.name, { value: metric.value });
});
return null;
}
For advanced analytics setup:
// instrumentation-client.ts
export function register() {
// Initialize analytics, error tracking, etc.
console.log('Analytics initialized');
}
import { inject } from '@vercel/analytics';
// Call once on app load
inject();
// Or with options
inject({
mode: 'production',
debug: true,
});
import { Analytics } from '@vercel/analytics/react';
function App() {
return (
<>
<YourApp />
<Analytics />
</>
);
}
<Analytics
beforeSend={(event) => {
// Remove query params from URLs
const url = new URL(event.url);
url.search = '';
event.url = url.toString();
// Filter specific paths
if (event.url.includes('/admin')) {
return null;
}
return event;
}}
/>
Analytics are disabled by default in development. Override:
<Analytics mode="development" debug={true} />
Or use environment variable:
# .env.local
NEXT_PUBLIC_VERCEL_ANALYTICS_DEBUG=true
Analytics are available in the Vercel Dashboard:
<!-- src/routes/+layout.svelte -->
<script>
import { inject } from '@vercel/analytics';
import { browser } from '$app/environment';
if (browser) {
inject();
}
</script>
<slot />
---
// src/layouts/Layout.astro
import { Analytics } from '@vercel/analytics/react';
---
<html>
<body>
<slot />
<Analytics client:only="react" />
</body>
</html>
<!-- app.vue -->
<script setup>
import { inject } from '@vercel/analytics'
onMounted(() => {
inject()
})
</script>
import { track } from '@vercel/analytics';
interface PurchaseEvent {
productId: string;
price: number;
quantity: number;
}
function trackPurchase(event: PurchaseEvent) {
track('purchase', event);
}
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.