Skip to main content
20% off 3 months · code LAUNCH20 · until 31 October

How do I add analytics to a v0 app?

19 September 2026 · by Nordva, who make Nordva Launch

The short answer

v0 builds Next.js apps, so the analytics tag belongs in the root layout, once, for every page. Copy your script tag from Nordva Launch, paste the prompt below into v0's chat with the tag at the end, publish to production, and add your vercel.app address to the site in Launch. Visits, sources and signups then appear under Insights.

The prompt for v0
Add Nordva Launch web analytics to this Next.js app.

1. In the root layout (app/layout.tsx), add the script tag I paste at the end of this message inside <head>, as a plain <script> element with the same attributes. Keep defer. Don't use next/script for it, don't load it in any other file, and don't load it twice.
2. Add data-nordva-goal="signup" to the main signup or "Get started" button, so clicks on it count as a goal.
3. Don't add any other analytics, cookie banner or tracking code, and don't change anything else.
4. Tell me which files you changed.

The script tag:

Why the root layout

v0’s docs say it builds with Next.js, React, TypeScript, Tailwind CSS and shadcn/ui. In a Next.js app with the App Router, app/layout.tsx wraps every page, so a tag placed there loads once and stays loaded while people move between pages. Launch’s script notices those in-app page changes by itself, so every page view counts without extra code.

The prompt asks for a plain <script defer> element rather than the next/script component. Both work, but the plain element keeps the tag exactly as Launch gave it, which makes it easy to check later and easy for v0 to leave alone.

Step by step

  1. Get your script tag. Sign in to Nordva Launch and open Insights. The setup card shows your tag with your site id filled in:

    <script defer src="https://e.nordva.dev/v1/s.js" data-site="ste_…"></script>
  2. List your domains. Add your production address: the vercel.app address Vercel gave the project, and your own domain if you added one. Launch counts visits only from listed domains, so your clicks in v0’s preview are left out unless you list the preview’s address as well. That keeps your own testing out of the numbers.

  3. Paste the prompt. Copy the prompt above into v0’s chat and paste your tag at the end.

  4. Check the preview. The page should look and work exactly as before; the script only reads the page address and sends a small request. If anything changes, ask v0 to undo the last change and tell us.

  5. Publish. Click Publish at the top right of the chat, then Publish to Production.

  6. Check it. Open the production site in a new tab. The Insights card says “Your first visit is here.” when the first visit arrives, usually within a minute.

No keys needed

The analytics tag carries a site id, not an API key, so there’s nothing to add under environment variables for this step. The site id only lets a browser send visits for the domains you listed; it can’t read anything back.

If you later add a Launch waitlist or feedback form, that uses a publishable key. For a key that browser code reads, Next.js needs the NEXT_PUBLIC_ prefix on the variable’s name, and v0 keeps environment variables under Project menu → Settings → Environment Variables.

What you see after that

Visitors by source, with UTM tags and ?ref= on the first page, the pages people read, countries and cities on a map, devices, and clicks on your signup button. Launch leaves out known bots and traffic from data-centre networks, and never stores an IP address or the full browser string.

Tag the links you share, such as ?utm_source=producthunt&utm_campaign=launch, so each post is its own row.

When a visitor joins a Launch waitlist form, or your app calls nordva('identify', { email }) after a signup, Launch links the person to their first visit. With Stripe connected (read-only, on every plan), Insights shows the sources that brought paying customers, and on Indie, what each channel costs per customer.

Visitors in Europe

New sites use the auto tracking mode: a first-party cookie recognises returning visitors outside the EEA, the UK and Switzerland, and inside them only after your cookie banner gets a yes. European visits are still counted without one. With a banner, call nordva('consent', true) when someone accepts.

Limits

Free includes 10,000 analytics events a month per account and one funnel of up to three steps; Indie 100,000 events and five funnels. Free has no time limit and needs no card.

When Launch is the wrong tool

If all you want is page views and top pages for a site on Vercel, Vercel's own analytics may be enough. Launch is for founders who want each visit's source carried through to a signup and a payment.

v0's own docs, checked 19 September 2026

Builders change often. If a step no longer matches what you see, tell us and we will fix the page.

Also asked as
  • How do I add a script to the head in v0?
  • Adding analytics to a v0 project breaks the preview
  • How do I track visitors on a site made with v0?
Read next
Start free Free plan, no time limit · No card