Cookieless analytics for Next.js in 2 minutes
Add privacy-first product analytics to a Next.js App Router project: install, init once, track what matters.
Sep 23, 2026 · 1 min1. Install#
npm i @shipabase/jsNEXT_PUBLIC_SHIPABASE_KEY=SB-EU-xxxxxxxxxx2. Call init once, on the client#
"use client"; import { useEffect } from "react";import { init } from "@shipabase/js"; export function Providers({ children }: { children: React.ReactNode }) { useEffect(() => { init(process.env.NEXT_PUBLIC_SHIPABASE_KEY!); }, []); return <>{children}</>;}Wrap {children} in app/layout.tsx with <Providers>. Never call init in a Server Component.
3. Track what matters#
import { trackEvent } from "@shipabase/js"; trackEvent("project_created", { plan: "pro" });- Name events in
snake_case,object_verb, past tense:signup_completed,invoice_sent. - 5 to 15 events is typical. Track actions, not every click.
- Keep props anonymous: plan, count, variant. Never emails or user IDs.
Why no cookie banner?#
The SDK stores nothing in the browser: no cookies, no localStorage. Visitors are counted with an anonymous hash that changes every day. See how visitors are counted for the details.
FAQ
Does it work with the Pages Router?
Yes. Call init in a useEffect in pages/_app.tsx.
Are page views tracked automatically?
Yes, since @shipabase/js 0.4, including client-side route changes in the App Router.


