Select your framework below to view instructions on using the Vercel Web Analytics in your project.
To start tracking visitors and page views with Web Analytics, use the following steps:
On the Vercel dashboard, select your Project and then click the Analytics tab and click Enable from the dialog.
/_vercel/insights/*
) after your next deployment.Using the package manager of your choice, add the @vercel/analytics
package to your project:
pnpm i @vercel/analytics
The Analytics
component is a wrapper around the tracking script, offering more seamless integration with Next.js.
If you are using the pages
directory, add the following component to your main app file:
import type { AppProps } from 'next/app';
import { Analytics } from '@vercel/analytics/react';
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<Component {...pageProps} />
<Analytics />
</>
);
}
export default MyApp;
You can deploy your app to Vercel's global Edge Network by running the following command from your terminal:
vercel deploy
Once your app is deployed, it's ready to begin tracking visitors and page views.
Learn more about how Vercel supports privacy and data compliance standards with Vercel Web Analytics.