SDK reference
track()
Send a named event from any Node backend, fire-and-forget.
track() sends one event to Atune for a customer account. It works in any
Node 18+ runtime and needs atune 0.1.3 or later.
import { track } from "atune";
// Where your code already knows the customer account (team, org or company)
// and the signed-in user. Don't await it: tracking never delays the response.
void track("feature.report.generated", {
accountId: session.orgId,
userId: session.userId,
properties: { reportType: "activation" },
});Signature
track(event: string, input: TrackInput, options?: AtuneRequestOptions): Promise<void>
type TrackInput = {
accountId: string; // the customer you bill
userId?: string;
properties?: Record<string, unknown>;
subscription?: AtuneSubscription; // stage, plan, seats, mrr, currency, trialEndsAt
};Properties are stored as sent. Keep them to ids and categories: no special-category data, ID numbers, passwords, payment details or free text your users typed. See Identity, PII & the DPA.
Options: { apiKey, url, fetch, timeoutMs }. apiKey and url fall back to
ATUNE_API_KEY and ATUNE_URL; timeoutMs defaults to 1000.
Behavior
- Never throws. Network errors and timeouts are swallowed, so
void track(...)can't break a request. - Sends nothing without an event name, an
accountId, an API key or a URL. - Posts to
/api/v1/eventson yourATUNE_URLhost. See the events API.
On Next.js, the middleware already captures every
signed-in request. Use track() there only for named business events.