Add analytics and revenue tracking to your v0 app

v0 builds a Next.js app and deploys it to Vercel. Which channel sends visitors, and which visit paid, still needs a tag and a key.

Updated Dec 4, 2026.

The short answer.

v0 apps are built with Next.js, so the Appsdash tag goes inside <head> in app/layout.tsx. Paste the prompt below into the v0 chat, or edit the file in the Code tab and save. Publish the changes, open the live address once, and the visit counts. Then connect the Stripe account behind your checkout with a restricted read-only key to see revenue next to traffic.

The tag for v0.

Add your app to Appsdash first: its install step shows this tag with your own id in place of YOUR_SITE_ID.

app/layout.tsx, inside <head>tsx
<script defer src="https://appsdash.co/v/s.js" data-site="YOUR_SITE_ID" />

Rather not touch the code? Paste this into the v0 chat, with YOUR_SITE_ID replaced by your id:

v0 chat
Add this analytics script tag to my app. It goes inside <head> in app/layout.tsx (src/app/layout.tsx if the project uses src), written as JSX; add a <head> just above <body> if there is none. Don't use next/script. Keep it a plain <script> tag with these exact attributes (no npm package, no tag manager, no component that adds it later) and change nothing else.

<script defer src="https://appsdash.co/v/s.js" data-site="YOUR_SITE_ID"></script>

The root layout, with a plain tag

New v0 chats start from a Next.js app, and every page is wrapped by one layout file: app/layout.tsx, or src/app/layout.tsx when the project has a src folder. The tag goes inside <head> there, in the form shown on this page. No <head> yet? Add one just above <body>.

Keep it the plain tag shown here: it is in the page from the first moment, so the first view counts and the install check can see it. To do it yourself, open the Code tab from the preview toolbar, click the file, paste, and save with Cmd+S or Ctrl+S.

Revenue from Stripe

v0 adds payments through the Vercel Marketplace, and Stripe is one of them. A Stripe test sandbox can be claimed when you publish; real payments run on your live Stripe account, so make the key for Appsdash in live mode: test payments aren't revenue.

Settings > Revenue in Appsdash has a link that opens Stripe with the right Read permissions already ticked: create the key there and paste it back. Appsdash reads payments, subscriptions and refunds every 15 minutes and never writes. One Stripe account can feed several apps, each counting only its own products.

For revenue per source, the Stripe checkout needs the visit id as its client_reference_id. Ask the v0 chat to make that change, with the code lines on this page as the example.

Check that it works

Open Publish and select Publish Changes. Preview addresses don't count; your production address, or your own domain, does. Open it once with any ad blocker off.

The Appsdash install step says Counting when the first visit lands. Check installation, in the app's Settings in Appsdash, opens your home page and sends a test visit through the tag.

How to set it up.

14 days of everything, no card. Then from $29 a month for up to 5 apps, up to $99 for 50, every feature on each.

  1. Add the app. Type its production address. Appsdash gives you the tag with your site id filled in.
  2. Paste the prompt. Into the v0 chat. Or, in the Code tab, paste the tag inside <head> in app/layout.tsx.
  3. Publish Changes. Then open the live address once. The install step turns to Counting.
  4. Connect Stripe. A restricted read-only key from your live Stripe account, in Settings > Revenue.

Tie each sale to its visit.

Optional: revenue counts without it. With it, every sale shows the source, page and campaign of the visit that bought.

Stripe Checkout: Your checkout route (server)js
// browser: send the visit id with the request that makes the session
fetch("/api/checkout", { method: "POST", body: JSON.stringify({ priceId, visit: window.appsdash?.visit?.() ?? "" }) });

// server
const session = await stripe.checkout.sessions.create({
  mode: "subscription", // or "payment"
  line_items: [{ price: priceId, quantity: 1 }],
  client_reference_id: visit || undefined,
  success_url, cancel_url,
});

Already use client_reference_id? Put it in metadata: { appsdash_visit: visit } instead. The key needs Checkout Sessions read.

What it doesn't do.

  • Preview deployments don't count: only the address you added and its subdomains do.
  • Some ad blockers stop analytics scripts, so a few visitors won't show.
  • Without the visit id on the checkout session, a sale still counts, but is matched to a visit only if exactly one person was on the site in the 30 minutes before it.

Questions.

Why a plain script tag?

A tag added later by code isn't in the page the server sends, so the install check can't see it and the first view can be missed. The prompt asks for the plain tag.

Does it work if I move the project off v0?

Yes. It's one tag in your own layout file, so it stays with the code wherever you deploy it.

Will it slow the app down?

No. The script is under 2 KB and loads after the page, so the page never waits for it.

See which app and which channel pays.

Try Appsdash free

14 days free · no card