Quickstart
Install the SDK, call init once, and see your first event. Five minutes, no cookie banner.
- 1
Install the SDK
Terminal npm i @shipabase/jsZero dependencies, about 2 KB gzipped. Works with npm, pnpm, yarn and bun.
- 2
Add your app key
.env.local NEXT_PUBLIC_SHIPABASE_KEY=SB-EU-xxxxxxxxxxFind it in the dashboard, on your app’s Setup page. It looks like
SB-EU-followed by 10 lowercase letters or digits. - 3
Call init once, on the client
app/providers.tsx "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!, { appVersion: "1.0.0" }); }, []); return <>{children}</>;}Then wrap
{children}inapp/layout.tsxwith<Providers>. Never callinitin a Server Component.src/main.tsx import { init } from "@shipabase/js"; init(import.meta.env.VITE_SHIPABASE_KEY, { appVersion: import.meta.env.VITE_APP_VERSION });src/main.ts import { init } from "@shipabase/js"; init(import.meta.env.VITE_SHIPABASE_KEY, { appVersion: import.meta.env.VITE_APP_VERSION });server.ts import { init, trackEvent, flush } from "@shipabase/js/node"; init(process.env.SHIPABASE_KEY!, { appVersion: "2.3.0" }); trackEvent("report_generated", { pages: 12, format: "pdf" }); // Short-lived process? Flush before exit.await flush(); - 4
Track what matters
any client component import { trackEvent } from "@shipabase/js"; trackEvent("project_created", { plan: "pro" });Name events in
snake_case,object_verb, past tense. Page views are already tracked automatically: no need to add them. See Page views. - 5
Check your first event
Trigger the action locally, then open your app’s Setup page in the dashboard: it shows the first event as soon as it arrives. Local events are flagged
isDebug.Nothing shows up? See Verify your setup.