home / skills / andrelandgraf / fullstackrecipes / using-analytics
This skill helps you implement and test Vercel Web Analytics, track custom events, and monitor conversions across components and forms.
npx playbooks add skill andrelandgraf/fullstackrecipes --skill using-analyticsReview the files below or copy the command above to add this skill to your agents.
---
name: using-analytics
description: Track custom events and conversions with Vercel Web Analytics. Covers common events, form tracking, and development testing.
---
# 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-analytics` in Fullstack Recipes
- URL: https://fullstackrecipes.com/recipes/using-analytics
---
### Tracking Custom Events
Track user actions and conversions:
```typescript
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:
```typescript
// 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
```tsx
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
```tsx
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:
```tsx
// In layout.tsx
<Analytics mode="development" />
// Or just log to console
<Analytics debug />
```
### Viewing Analytics
View analytics in the Vercel dashboard:
1. Go to your project in [Vercel Dashboard](https://vercel.com/dashboard)
2. Click "Analytics" in the sidebar
3. View page views, visitors, and custom events
---
## References
- [Vercel Web Analytics](https://vercel.com/docs/analytics)
- [Custom Events](https://vercel.com/docs/analytics/custom-events)
This skill shows how to track custom events and conversions with Vercel Web Analytics, including common event patterns, form submission tracking, and techniques for development testing. It provides practical TypeScript/React examples and guidance for viewing analytics in the Vercel dashboard. The goal is to make event tracking predictable and useful for product and growth metrics.
The skill uses the @vercel/analytics SDK to emit named events and optional property objects from components, handlers, and form submit callbacks. Events are sent in production by default; the Analytics component supports development and debug modes for local testing. Events are then visible in the Vercel dashboard alongside page views and visitor data.
Do events send in development by default?
No. Events are only sent in production by default. Enable development mode or debug to test locally.
What should I include in event properties?
Include contextual, non-sensitive fields that help analyze behavior (plan, price, source, counts). Avoid personal data.