TrackStack Docs
TrackStack Docs
DashboardPricingTrackStack DocsQuickstartExamplesSDK SetupB2B SaaS EventsSupported PlatformsIntegrationsAPI Playground
GitHub

Quickstart

Send your first conversion event in minutes.

Prerequisites

  • TrackStack publishable API key from your dashboard
  • Node.js and pnpm in your app environment

1) Install the SDK

pnpm add @trackstack/sdk

2) Add environment variables

NEXT_PUBLIC_TRACKSTACK_KEY=ts_live_xxx
NEXT_PUBLIC_POSTHOG_KEY=phc_xxx # optional

3) Initialize TrackStack

import { createTrackStack } from "@trackstack/sdk";

export const trackstack = createTrackStack({
  publicKey: process.env.NEXT_PUBLIC_TRACKSTACK_KEY!,
  edge: "https://edge.gettrackstack.com",
  posthog: {
    key: process.env.NEXT_PUBLIC_POSTHOG_KEY!,
    host: "/_ph",
  },
});

4) Capture a conversion

await trackstack.init(); // optional when using TrackStackProvider in React

trackstack.capture("Purchase", {
  eventId: "evt_001",
  email: "jane@example.com",
  value: 1299,
  currency: "USD",
  transactionId: "txn_001",
  plan: "Growth",
});

For pages that emit multiple events quickly, call capture() for each action. The SDK queues and batches edge delivery automatically.

5) Verify delivery

  1. Open dashboard delivery views and compare attempted vs delivered.
  2. Inspect failed deliveries and DLQ entries.
  3. Use API playground to test the same OpenAPI contract used by the edge.

Key handling

  • Use only the publishable TrackStack key in app code (NEXT_PUBLIC_TRACKSTACK_KEY).
  • Keep destination platform credentials in dashboard settings; TrackStack stores them encrypted server-side.

Next steps

  • SDK setup — React/Next.js integration patterns
  • B2B SaaS events — Standardize event naming across teams
  • Supported platforms — Destination-specific behavior and overrides

TrackStack Docs

Edge conversion infrastructure docs for setup, event contracts, and delivery reliability.

Examples

Practical integration recipes for Next.js, auth, payments, and edge validation.

On this page

Prerequisites1) Install the SDK2) Add environment variables3) Initialize TrackStack4) Capture a conversion5) Verify deliveryKey handlingNext steps