Track named events
Send explicit business events like feature.report.generated from the actions that matter.
Behavior capture records requests automatically. Sometimes you also want to fire an explicit named event — "report generated", "teammate invited" — so understanding can reason about the actions that matter most to your product.
Send a named event
Pick 3–5 places where a customer account does something meaningful — not every route, not static assets, not health checks. Good candidates: creating a resource, completing a core action, an admin acting for a customer.
Call track() where your handler already knows the account and user. Don't
await it, so a slow or down Atune can never delay or break the response:
// app/api/reports/route.ts — track "report generated"
import { track } from "atune";
export async function POST(req: Request) {
const { orgId, userId } = await getYourSession(req); // your verified session
// ...your existing handler logic, unchanged
void track("feature.report.generated", {
accountId: orgId,
userId,
properties: { reportType: "activation" },
});
return Response.json({ ok: true });
}Not on Node? Send the same event with the HTTP API, see Any backend.
accountId is the customer account (team, org or company), not just the
signed-in user. Take it from your verified server session, never from a value
the client sends.
Verify it landed
Trigger the action, then open Settings → Event log in Atune and confirm the newest event has the name, account and user you expect.