SDKs

Server-side integration

Send events to Fluxner from a Node.js server.

The renamed @fluxner/node package has not been published. Use the HTTP API from your server with Node's built-in fetch instead.

const response = await fetch("https://fluxner.com/api/track", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.FLUXNER_API_KEY}`,
  },
  body: JSON.stringify({
    site_id: "YOUR_SITE_ID",
    type: "custom_event",
    event_name: "order_completed",
    pathname: "/checkout",
    hostname: "YOUR_WEBSITE_HOSTNAME",
    user_id: "user-123",
    properties: JSON.stringify({ plan: "pilot" }),
  }),
  signal: AbortSignal.timeout(5000),
});
if (!response.ok) throw new Error(`Fluxner returned ${response.status}`);

Keep the API key on the server; never expose it in browser code. See the sending-events reference for the complete payload and the site's scoped API-key requirements.