SDKs Overview
Official SegOps client libraries for server-side event ingest and client-side tracking. All SDKs share the same interface: track, identify, flush, and shutdown.
Available SDKs#
| Language | Package | Minimum Runtime |
|---|---|---|
| TypeScript / JavaScript | @segops/sdk | Node 18 / modern browser |
| Go | github.com/segops/sdk-go | Go 1.22 |
| Swift | SegOps (Swift Package) | iOS 16, macOS 13 |
| Kotlin | io.github.segops:segops-kotlin | JVM 17, Android API 26 |
Common Event Schema#
All SDKs use the same canonical event schema:
| Field | Type | Required | Description |
|---|---|---|---|
| userId / user_id | string | Yes | Unique user identifier (email, UUID, etc.) |
| eventType / event_type | string | Yes | Snake-case event name, e.g. page_viewed |
| occurredAt / occurred_at | ISO 8601 string / Date | No | Defaults to current time |
| payload | object | No | Arbitrary event properties |
Batching#
All SDKs buffer events locally and flush them in batches for efficiency:
| Setting | Default |
|---|---|
| Batch size (auto-flush) | 20 events |
| Flush interval | 5 seconds |
| Max retries on 5xx | 3 |
Events are never dropped on shutdown — all SDKs guarantee a final flush before the process exits.
User Identification#
Use identify to set or update user-level traits (email, plan, company, etc.). This emits a context_identified event whose payload becomes queryable as user_property conditions in segment rules.
Authentication#
All SDKs authenticate with an API key passed in the Authorization: ApiKey sk_... header. Create keys in the dashboard under Settings → API Keys.
Choosing an SDK#
- Node.js / Next.js / browser — use the TypeScript SDK. It works in both environments and handles page-visibility flushes for browsers automatically.
- Go microservices — use the Go SDK. It is goroutine-safe and has zero external dependencies.
- iOS / macOS apps — use the Swift SDK via Swift Package Manager.
- Android / JVM services — use the Kotlin SDK via Gradle.
- Any other language — use the REST API directly.