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

Examples

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

Use these recipes to implement TrackStack quickly with predictable production behavior.

Recommended implementation paths

GoalStart hereWhy
Baseline setupQuickstartInstall SDK and send first event
App integrationSDK setupProduction React/Next.js patterns
Auth identity syncIntegrationsClerk/Auth0/NextAuth identity helpers
Event taxonomyB2B SaaS eventsCanonical naming for clean reporting
Destination behaviorSupported platformsPlatform-specific delivery expectations
API validationAPI playgroundTest requests against runtime OpenAPI

Copy-paste snippets

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

export const trackstack = createTrackStack({
  publicKey: process.env.NEXT_PUBLIC_TRACKSTACK_KEY!,
  edge: process.env.NEXT_PUBLIC_EDGE_URL ?? "https://edge.gettrackstack.com",
});
trackstack.capture("Purchase", {
  eventId: "evt_001",
  email: "jane@example.com",
  value: 1299,
  currency: "USD",
  transactionId: "txn_001",
});

eventId is optional. Provide it when you need deterministic dedup IDs; otherwise the SDK generates one per event.

Environment checklist

  • NEXT_PUBLIC_TRACKSTACK_KEY (required)
  • NEXT_PUBLIC_EDGE_URL (optional override)
  • NEXT_PUBLIC_POSTHOG_KEY (optional, when using PostHog proxy)

How to use these examples

  • Start with Quickstart to validate ingestion
  • Wire framework/auth behavior with SDK setup and Integrations
  • Verify payloads in API playground
  • Keep production naming aligned with B2B SaaS events

Quickstart

Send your first conversion event in minutes.

SDK Setup

Keep app tracking code thin while edge infrastructure handles destination complexity.

On this page

Recommended implementation pathsCopy-paste snippetsEnvironment checklistHow to use these examples