Server-side SDK (Node.js)
For backend events — payments, payouts, settlements, jobs — use @traceiq/node. Server events are the most trustworthy source of revenue: the amount comes from your systems, not the browser. Events are queued and flushed in batches, so request handlers never block on the network.
bash
npm install @traceiq/node
ts
import { TraceIQ } from '@traceiq/node';
const traceiq = new TraceIQ({
projectId: 'YOUR_PROJECT_ID',
writeKey: process.env.TRACEIQ_WRITE_KEY, // keep server keys secret
endpoint: 'https://api.traceiq.run',
});
// A trustworthy revenue event, straight from your payments service:
traceiq.capture({
event: 'payout_succeeded',
userId: 'user_123',
properties: { amount: 50000, currency: 'NGN' },
});
traceiq.identify({ userId: 'user_123', traits: { kyc_tier: 2 } });
await traceiq.shutdown(); // flush before a short-lived process exitsEvents flush automatically by size (flushAt) or on a timer (flushIntervalMs). Call shutdown() in scripts and serverless functions so nothing is lost on exit.

