Only 3 steps to enable vercel analytics on your astro

Table of Contents

1. Install @vercel/analytics

pnpm i @vercel/analytics

2. Enable analytics in your astro.config.mjs.

Enable analytics in your astro.config.mjs below. Just add “webAnanlytics” object to versel() as an argument.


import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';
export default defineConfig({
  output: 'server',
  adapter: vercel({
    webAnalytics: {
      enabled: true,

You can enable it even if your “output” setting is “static”;

3. Deploy as production

vercel --prod

That’s all.