Sign up at app.segops.ai. During onboarding you will be prompted to choose a tenant slug — a short lowercase identifier like acme that scopes all your data. You can invite team members immediately from Settings → Team.
Step 2 — Get your API key
Navigate to Settings → API Keys and click + New Key. Copy the key immediately — it is shown only once. Keys start with sk_.
bash
# Keep this secret — treat it like a password
export SEGOPS_API_KEY="sk_live_xxxxxxxxxxxxxxxx"
Step 3 — Install the SDK
The TypeScript/JavaScript SDK works in Node.js and modern browsers:
bash
npm install @segops/sdk
Initialize the client once (e.g., in a lib/segops.ts file):
typescript
import { SegOpsClient } from '@segops/sdk';
export const segops = new SegOpsClient({
apiUrl: 'https://api.segops.ai',
apiKey: process.env.SEGOPS_API_KEY!,
});
Step 4 — Send your first event
typescript
// Track a page view
segops.track({
userId: 'user-123',
eventType: 'page_viewed',
payload: { path: '/pricing' },
});
// Identify a user (sets traits for user_property conditions)
segops.identify({
userId: 'user-123',
traits: { email: '[email protected]', plan: 'starter' },
});
// On Node.js server shutdown, flush any buffered events
process.on('SIGTERM', async () => {
await segops.shutdown();
process.exit(0);
});
ℹ Note
Events are buffered in memory and flushed in batches every 5 seconds or when the buffer reaches 20 events. Call segops.flush() to force an immediate flush.
Step 5 — Define a segment
In the UI go to Segments → New Segment. Give it a name like “Pricing Page Visitors”, add a condition of type event_count with event_type page_viewed, operator gte, value 1.
Trigger the async membership computation. A background worker evaluates every user against your segment definition and writes results to the analytics warehouse.