GETTING STARTED
Capture your first TrafficWar event with Node.js.
The official Node.js server SDK is the recommended path. It batches events, compresses requests, retries delivery, and waits for durable server acknowledgement.
Install the SDK
npm install @trafficwar/nodeCreate a client and capture an event
import { TrafficWar } from "@trafficwar/node";
const trafficwar = new TrafficWar({
apiKey: process.env.TRAFFICWAR_API_KEY!,
});
trafficwar.capture({
event: "http",
label: "Checkout",
path: "/v1/checkout",
http_method: "POST",
source: "checkout-api",
operation_type: "route.handler",
latency_ms: 84.2,
status_code: 200,
});
await trafficwar.close();Keep the key on the server
Create a service and API key in the panel. Store the token in a server-side secret such as TRAFFICWAR_API_KEY; never put a server key into browser code or a public repository.
The Python client is implemented in the SDK repository but is not published yet. Use the Node.js package or the HTTP ingest API until a Python release is announced.