@zevruna/analytics
v0.1.1
Published
Isomorphic, batched analytics client used by Zevruna. Never blocks, never throws.
Maintainers
Readme
@zevruna/analytics
Isomorphic, batched analytics client used by Zevruna.
Published because the CLI and SDK depend on it. It is an internal component, not a product — the API is small and may change with Zevruna's needs.
Behaviour
- Batches events and flushes on a 2s timer, at 20 queued, or on
pagehide. - Never blocks and never throws. A failed send is swallowed: analytics must not break the thing it measures.
setSink(fn)installs a direct sink and flushes immediately, bypassing the network path. Use it server-side — on serverless a batching timer may never fire before the function is frozen.
Usage
import { track, initBrowser, setSink } from "@zevruna/analytics";
track("api", "incident_created", { severity: "breaking" });
initBrowser(); // browser: anon id, pageviews, and [data-za] click captureConfiguration
ANALYTICS_BASE=… # collector base in Node (window.__za_base in the browser)
ZEVRUNA_TELEMETRY=0 # Node opt-outIn the browser, opt out with window.__za_off = true or, per device,
localStorage.setItem("za_off", "1").
License
MIT
