app/layout.tsx (or your root layout / index.html <head>) · open source (MIT) · ask in plain English

Add analytics to a Vercel app Vercel.

smolanalytics is open-source analytics for any site you ship on Vercel. Vercel hosts your framework, so the two script tags go in that framework's root layout or head, Next.js app/layout.tsx, a plain index.html, whatever you deploy. It autocaptures pageviews, clicks, engagement and errors, and you own the raw data.

app/layout.tsx (or your root layout / index.html <head>)
// Next.js on Vercel: app/layout.tsx, inside <head>
<script src="https://YOUR-INSTANCE/sdk.js"></script>
<script dangerouslySetInnerHTML={{ __html:
  'smolanalytics.init("WRITE_KEY", { host: "https://YOUR-INSTANCE" })'
}} />

Vercel has no injection point of its own, the snippet lives in your framework's root head. For a static index.html deploy, just paste the two plain tags.

how do I add analytics to vercel?

smolanalytics is open-source analytics for any site you ship on Vercel. Vercel hosts your framework, so the two script tags go in that framework's root layout or head, Next.js app/layout.tsx, a plain index.html, whatever you deploy. It autocaptures pageviews, clicks, engagement and errors, and you own the raw data.

Vercel is a host, not a framework, so there's no Vercel-specific SDK to add. You put the smolanalytics script tags wherever your framework renders its <head>: app/layout.tsx or pages/_document.tsx for Next.js, index.html for a Vite or static deploy. Once they load, autocapture handles pageviews and clicks across every route with no per-page setup.

The reason to run it on Vercel specifically: you keep the data in your own instance instead of a black box, and answers are computed deterministic reports with a CI test proving they can't be hallucinated. Self-host the single Go binary free, or use hosted from $29/mo. For SPA route changes, smolanalytics tracks client navigations automatically, so Next.js app-router transitions still register as pageviews.

Honest pricing: 14-day full trial, no credit card. Then Solo $29/mo, never metered on seats or sites. Overage is $5/million with an emailed receipt, the dashboard never locks, and self-hosting the single Go binary is free forever (MIT).

Add analytics to Vercel tonight.

One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.

questions

How do I add analytics to Vercel?
smolanalytics is open-source analytics for any site you ship on Vercel. Vercel hosts your framework, so the two script tags go in that framework's root layout or head, Next.js app/layout.tsx, a plain index.html, whatever you deploy. It autocaptures pageviews, clicks, engagement and errors, and you own the raw data.
Do I need a cookie banner?
Not in cookieless mode. smolanalytics can run without storing anything on the device, so there is no consent banner to add. You still get visitors, referrers, funnels, retention, and paths, and AI-assistant referrals (chatgpt.com, claude.ai, perplexity.ai) show up as their own channel.
Is it enough for a real product, or just page counts?
It does funnels, retention, paths, cohorts, and a daily verdict on what to fix, from the same events, and you ask it in plain English. It deliberately skips session replay, feature flags, and experiments. If you want a straight answer on what to fix, that you own and can self-host free, it fits.

keep reading