@usevelora/sdk
v0.1.0
Published
Velora's browser tracking SDK — init/identify/track/reset.
Readme
@usevelora/sdk
Velora's browser tracking SDK.
Install
npm install @usevelora/sdkUsage
import { Velora } from "@usevelora/sdk";
Velora.init("pk_xxx", { apiHost: "https://ingest.yourvelora.com" });
Velora.identify(user.id, { email: user.email });
Velora.track("project_created", { plan: "free" });
// on logout
Velora.reset();pk_xxx is your project's public key — safe to use directly in browser
code. Never use a secret (sk_...) key here; secret keys are for
server-side tracking only (see your Velora project's setup page).
API
Velora.init(publicKey, { apiHost, flushIntervalMs?, flushBatchSize? })— call once, as early as possible.Velora.track(event, properties?)— record a meaningful product action.Velora.identify(distinctId, traits?)— associate subsequent events with a known user.Velora.reset()— call on logout, so the next person on the same browser doesn't inherit the previous person's identity.
Events are queued and flushed automatically (on an interval, when the queue
fills, and on page unload via navigator.sendBeacon) — you don't need to
call anything else.
