# Install on v0

> v0 generates Next.js projects, so the tag belongs in the root layout with next/script.

Section: Installation guides  
Canonical page: https://statsy.co/docs/install/v0  
Last updated: 2026-09-15

v0 produces Next.js code, so the Next.js instructions apply: the tag lives in the root layout and loads once for the whole app.

## Where it goes

Open `app/layout.tsx` in the generated project, or ask v0 to add it, and use `next/script`.

```tsx
import Script from 'next/script';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          defer
          strategy="afterInteractive"
          src="https://statsy.co/js/script.js"
          data-website-id="ws_XXXXXXXX"
          data-domain="yourstartup.com"
        />
      </body>
    </html>
  );
}
```

Full details, including the Pages Router variant, are in [Install on Next.js](https://statsy.co/docs/install/nextjs).

## Confirm it works

Deploy the project and open it on your own domain, then check **Live**. Navigation between routes is counted automatically.

## Preview URLs are dropped

A v0 preview and a Vercel preview deployment both run on hosts that are not your domain, so their beacons are discarded. Ship to production on your own domain, or add the preview host under **Site settings › General › Additional domains** if you deliberately want that traffic.

> **Watch out.** Regenerating a component can drop the tag from the layout. After a round of edits, view source on the deployed page and search for `statsy`.

Previous: [Install on Lovable](https://statsy.co/docs/install/lovable)  
Next: [Install on Bolt](https://statsy.co/docs/install/bolt)