Docs/Get started
.md

Quickstart

Install the SDK, call init once, and see your first event. Five minutes, no cookie banner.

  1. 1

    Install the SDK

    Terminal
    npm i @shipabase/js

    Zero dependencies, about 2 KB gzipped. Works with npm, pnpm, yarn and bun.

  2. 2

    Add your app key

    .env.local
    NEXT_PUBLIC_SHIPABASE_KEY=SB-EU-xxxxxxxxxx

    Find it in the dashboard, on your app’s Setup page. It looks like SB-EU- followed by 10 lowercase letters or digits.

  3. 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} in app/layout.tsx with <Providers>. Never call init in a Server Component.

  4. 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. 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.