Skip to main content

Add the script

Copy your project ID from Settings → General, then add the tracker to the right file for your router.
Use Next.js Script. It loads the tracker outside your app bundle.

App Router

Add the script to your root app/layout.tsx:
app/layout.tsx

Pages Router

Add the script to your pages/_app.tsx:
pages/_app.tsx

npm package

Prefer a package? Install openrevenue and use the thin OpenRevenueScript helper (still loads the CDN tracker), or call init from a client component.
app/layout.tsx
components/analytics.tsx

Verify

Deploy your app and visit any page. A pageview should appear in your OpenRevenue dashboard within seconds.
OpenRevenue ignores localhost and 127.0.0.1 automatically. Open your live site, not the dev server.