Skip to main content
General
Observability

Vercel Analytics

Learn how to use Vercel Analytics for real-time traffic data.

Open MarkdownFull AI corpusFeedback

The starter kit already renders Vercel Web Analytics from the root layout. You only need to enable the service for your Vercel project and deploy the application.

What is already configured

The repository includes @vercel/analytics and renders its Next.js component in app/layout.tsx:

app/layout.tsx
import { Analytics } from '@vercel/analytics/next';

// Inside the root layout body
<Analytics />;

This records page views after Web Analytics is enabled. It does not require an environment variable.

Enable Web Analytics

  1. Open your project in the Vercel dashboard.
  2. Select Analytics in the project sidebar.
  3. Enable Web Analytics.
  4. Deploy the application again so Vercel can add the analytics routes to the deployment.
  5. Visit the deployed application, then return to the Analytics dashboard to confirm that data arrives.

Track a product event

Automatic page views answer traffic questions. Add custom events only for product actions that matter, such as completing onboarding or starting checkout:

components/checkout-button.tsx
'use client';

import { track } from '@vercel/analytics';

export function CheckoutButton() {
  return (
    <button
      onClick={() =>
        track('checkout_started', {
          location: 'pricing'
        })
      }
    >
      Continue to checkout
    </button>
  );
}

Do not send email addresses, names or other personal data as event properties.

Verify the integration

If the dashboard remains empty:

  1. Confirm Web Analytics is enabled for the correct Vercel project.
  2. Confirm the deployment was created after activation.
  3. Visit the production deployment with tracking protection or ad blockers disabled.
  4. Check that requests to /_vercel/insights/* are not blocked by a reverse proxy or Content Security Policy.
  5. Confirm app/layout.tsx still renders <Analytics />.

Use Vercel's Web Analytics troubleshooting guide for provider-specific diagnostics.

Web Analytics is designed without cookies, but privacy obligations depend on your users, configuration and jurisdiction. Document the service in your privacy notice and review Vercel's privacy guidance before launch. Do not treat the default integration as a substitute for legal review.