Skip to content

Install on v0

View as Markdown

Add Reveata to a Next.js app generated with Vercel v0.

On this page

v0 generates Next.js apps with the App Router, so the snippet goes in the root layout, app/layout.tsx, once. Next.js has a full guide in Install on Next.js; this page covers doing it from v0.

Add it to your app

Either ask v0 in the chat, for example:

In app/layout.tsx, import Script from next/script and add this inside <body>, after {children}, exactly as written, changing nothing else:

<Script src="https://reveata.com/js/script.js" data-website-id="ws_your_tracking_id" strategy="afterInteractive" />

Or edit app/layout.tsx yourself in v0’s code view, or in the GitHub repository connected to the project:

tsx
// app/layout.tsx
import Script from 'next/script';

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

Replace ws_your_tracking_id with the id from your Reveata dashboard. Then publish: the first Publish creates the Vercel project, and later changes go live with Publish → Publish Changes (or by merging the pull request, for projects connected to GitHub). In Reveata, add the website with the address visitors use: your custom domain, or the .vercel.app address of the production deployment. Previews on other addresses are not counted.

Client-side navigation between pages is counted by the script.

Check it works

Open the deployed app in a private window, then check that the visit appears in your Reveata dashboard. If it doesn’t, follow Verify your installation.

Goals

Ask v0 to add data-reveata-goal="signup" to your signup button, or to call window.reveata?.('goal', 'signup') once a signup succeeds. See Custom goals.

Serve it from your own subdomain

Two options:

  • The managed proxy. With a custom domain, add one DNS record (for example stats.example.com) and use the new snippet Reveata gives you. See Managed proxy.
  • Rewrites in the app. A v0 app is a Next.js app on Vercel, so it can proxy the script and events itself: see Next.js and Vercel. Add the proxy secret as the REVEATA_PROXY_SECRET environment variable in the Vercel project.

Revenue

v0 adds Stripe through the Vercel Marketplace: it starts as a Stripe sandbox, which you claim into a new or existing Stripe account for production. The checkout code is in your Next.js app.

  1. Connect the live Stripe account in Reveata under Settings → Payments (restricted key or Connect with Stripe).
  2. Paste the prompt from Revenue in apps built with AI into v0. It sends window.reveata.metadata() to the route or server action that creates the checkout and puts the visitor id in the checkout metadata. Install on Next.js shows the server side.

Other providers: Connect a payment provider.

Common pitfalls

  • Changes not published. Edits in v0 reach the live app with Publish Changes (or the merged pull request).
  • Preview deployments. They run on other .vercel.app addresses and are refused unless you add them under Settings → General → Additional domains. Leaving them out keeps testing out of your numbers.
  • The sandbox. Payments in the Stripe sandbox are not imported from your live account. Claim the sandbox before you launch.

Was this helpful?