Apext

SDK

TypeScript / Web

Browser SDK with auto-tracking. Drop in a script tag and start sending events.

01.Install the SDK

bash
npm install @apext/orbit-sdk-ts

02.Initialize the client

typescript
import { initOrbitSdk } from "@apext/orbit-sdk-ts"

initOrbitSdk({
  apiKey: "YOUR_ORBIT_API_KEY",
  baseUrl: "https://apext.dev/orbit",
  serviceName: "my-web-app",
  autoTrack: true,
})

03.Track an event

typescript
import { getOrbitSdkClient } from "@apext/orbit-sdk-ts"

const orbit = getOrbitSdkClient()
orbit?.track({
  event_name: "user_signed_up",
  user_id: "user_123",
  event_properties: { plan: "pro" },
})

04.Identify the user (optional)

typescript
import { getOrbitSdkClient } from "@apext/orbit-sdk-ts"

getOrbitSdkClient()?.identify({
  user_id: "user_123",
  traits: { email: "user@example.com", display_name: "Jane Doe" },
})

05.Automatic error capture

typescript
// The SDK automatically catches:
//   - window.onerror (JS runtime errors)
//   - unhandledrejection (promise rejections)
//
// No setup required — autoTrack handles it.
// You can also send errors manually:
//   getOrbitSdkClient()?.error({ error_type: e.name, error_message: e.message, stack_trace: e.stack })