Solutions · Next.js apps

Analytics for Next.js apps, on every domain you serve.

White-label tracking for every custom domain your Next.js app serves. Add a proxy route and one component, and visits go through your own app.

The component

One component in your layout.

Pass each tenant’s site key to the Analytics component. Page changes in the app count by themselves.

  • Leave pages out, such as your admin
  • Add properties to every page view, such as the plan
  • Manual mode, where only views you send with view() count
  • A nonce for your Content Security Policy
Websites your Next.js app serves →
From nahnu-analytics-sdk/nextSummary
  • <Analytics siteKey />Page views
  • track()Events
  • identify()Signed-in users
  • view()Manual views

Hash routes and localhost can count too.

The proxy

Visits go through your own app.

createProxy() adds a route to your app, so nothing in the page points to an outside address. Visits are signed, so the stats count the real visitor and place.

  • Detects Vercel, Netlify and Fly for the visitor’s address
  • Trusts Cloudflare when the app is only reachable through it
  • Asks for every site’s secret in one call and keeps them for an hour
Websites your Next.js app serves →
From nahnu-analytics-sdk/next/serverSummary
  • createProxy()A route in your app
  • Signed visitsYes
  • Your own domainEvery tenant
  • Outside addresses in the pageNone

Made-up site keys are dropped without costing you requests.

Why it fits

Built for apps that serve many domains.

Every tenant gets its own stats, under your brand.

  • A site per tenant

    Made from your own sign-up, with the SDK.

  • Your brand only

    No outside address in the page.

  • Stats in your app

    Show each tenant their numbers with a read token.

  • Your Cloudflare

    The data lives in your own Cloudflare account.

Questions

Next.js questions

Something else? Ask us.

Does it work with the App Router?

Yes. The proxy is a route handler and the component goes in your layout.

Can I name the proxy folder?

Yes. The folder name is yours; tell the component with its base option.

Is the visitor’s address safe from spoofing?

The proxy believes only the header your host sets. On a server with nothing in front, pass your own ip function.

Can I skip the call for secrets?

Yes. Keep each site’s proxy secret in your database and pass a secret function.

Try it on your own sites.

Unlimited websites, every feature, one license.