Agent skill
using-analytics
Track custom events and conversions with Vercel Web Analytics. Covers common events, form tracking, and development testing.
Install this agent skill to your Project
npx add-skill https://github.com/andrelandgraf/fullstackrecipes/tree/main/.agents/skills/using-analytics
SKILL.md
Working with Analytics
Track custom events and conversions with Vercel Web Analytics. Covers common events, form tracking, and development testing.
Implement Working with Analytics
Track custom events and conversions with Vercel Web Analytics. Covers common events, form tracking, and development testing.
See:
- Resource:
using-analyticsin Fullstack Recipes - URL: https://fullstackrecipes.com/recipes/using-analytics
Tracking Custom Events
Track user actions and conversions:
import { track } from "@vercel/analytics";
// Basic event
track("signup_clicked");
// Event with properties
track("purchase_completed", {
plan: "pro",
price: 29,
currency: "USD",
});
Common Events to Track
Track meaningful user actions:
// Authentication
track("signup_completed", { method: "email" });
track("signin_completed", { method: "google" });
// Feature usage
track("chat_started");
track("chat_completed", { messageCount: 5 });
track("file_uploaded", { type: "pdf", size: 1024 });
// Conversions
track("trial_started");
track("subscription_created", { plan: "pro" });
track("upgrade_completed", { from: "free", to: "pro" });
Tracking in Components
import { track } from "@vercel/analytics";
function UpgradeButton() {
const handleClick = () => {
track("upgrade_button_clicked", { location: "header" });
// Navigate to upgrade page...
};
return <button onClick={handleClick}>Upgrade</button>;
}
Tracking Form Submissions
import { track } from "@vercel/analytics";
function ContactForm() {
const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
track("contact_form_submitted", { source: "footer" });
// Submit form...
};
return <form onSubmit={handleSubmit}>...</form>;
}
Testing in Development
Analytics only send in production by default. For development testing:
// In layout.tsx
<Analytics mode="development" />
// Or just log to console
<Analytics debug />
Viewing Analytics
View analytics in the Vercel dashboard:
- Go to your project in Vercel Dashboard
- Click "Analytics" in the sidebar
- View page views, visitors, and custom events
References
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
shiki-code-blocks
Syntax highlight code blocks with Shiki. Supports server-side rendering in RSC and automatic light/dark theme switching.
better-auth-emails
Add email verification, password reset, and account management emails to Better Auth using Resend.
ai-sdk-setup
Install the Vercel AI SDK with AI Elements components. Build a streaming chat interface with the useChat hook.
code-style-setup
Configure Prettier for code formatting and TypeScript for typechecking. Includes VSCode settings and EditorConfig for consistent code style. Skips ESLint/Biome to avoid config complexity.
using-nuqs
Manage React state in URL query parameters with nuqs. Covers Suspense boundaries, parsers, clearing state, and deep-linkable dialogs.
chat-naming
Generate descriptive chat titles from the first message using a fast LLM. Runs as a background workflow step after the main response to avoid delaying the experience.
Didn't find tool you were looking for?