Quick Start
This guide gets data flowing from a browser app to your Emit Vision dashboard in the shortest possible path. You'll install @emit-vision/sdk-js, call init(), fire a custom event, and see it appear in the dashboard.
Prerequisites
- A running Emit Vision instance (local or self-hosted)
- Your project API key (ingest token)
Find your ingest token on the project's Setup page in the dashboard. It starts
with evk_ and is write-only — safe to include directly in frontend
bundles. For local development the seeded key is
evk_local_development_seed_key_000000000000.
Step 1 — Install
bash npm install @emit-vision/sdk-js Step 2 — Initialize
Call init() once, as early as possible — before your app renders or routes. Calling it multiple times resets the internal queue, so treat it like a module-level side effect.
import { init } from "@emit-vision/sdk-js";
init({
apiKey: "evk_local_development_seed_key_000000000000",
environment: "development",
release: "[email protected]",
autoCapture: {
errors: true,
unhandledRejections: true,
},
});Step 3 — Send an event
import { captureEvent } from "@emit-vision/sdk-js";
captureEvent("app_loaded", {
path: window.location.pathname,
});Step 4 — Verify in the dashboard
- Open your Emit Vision dashboard
- Navigate to Events → Recent events
- You should see
app_loadedappear within a few seconds
Events are batched and flushed every 5 seconds by default. If you don't see
the event immediately, wait a moment or call await flush() right after
captureEvent() to force an immediate send.
Complete example
Here's everything in one file, ready to drop into a Vite or Create React App entry point:
import { captureEvent, flush, init } from "@emit-vision/sdk-js";
// Initialize once at app start — paste your ingest token from the Setup page
init({
apiKey: "evk_your_ingest_key",
environment: "production",
autoCapture: { errors: true, unhandledRejections: true },
});
// Track page loads
captureEvent("page_view", { path: window.location.pathname });
// Flush before the user navigates away
window.addEventListener("beforeunload", () => {
void flush();
});Next steps
- Installation — full setup for React, Next.js, and Node.js
- sdk-js reference — all
init()options,captureEvent,captureError, and more - Events — how events are structured and queried