2023-12-18
・ 1. Install @vercel/analytics
・ 2. Enable analytics in your astro.config.mjs.
・ 3. Deploy as production
pnpm i @vercel/analytics
Enable analytics in your astro.config.mjs below. Just add “webAnanlytics” object to versel() as an argument.
https://vercel.com/docs/analytics/quickstart#enable-analytics-in-your-astro.config.mjs-file
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”;
vercel --prod
That’s all.