Installation

Choose the tab for your stack. All packages share the same ingest contract — data from any of them appears in the same dashboard.

Browser SDK

Use @emit-vision/sdk-js for vanilla JS, Svelte, Vue, or any browser app without a React tree.

npm install @emit-vision/sdk-js
# or: pnpm add @emit-vision/sdk-js

Call init() at your app's entry point, before any other SDK calls:

import { init } from "@emit-vision/sdk-js";
 
init({
  // Paste your ingest token from the Setup page — safe to inline in browser code
  apiKey: "evk_your_ingest_key",
  environment: "production",
  release: "[email protected]",
  autoCapture: {
    errors: true,
    unhandledRejections: true,
  },
});

Bundle size

Bundle sizes are measured using Brotli compression (the default for modern CDNs and browsers). Limits are enforced in CI — a pull request that causes any package to exceed its budget will fail the sdk-size check.

PackageBrotlied sizeBudget
@emit-vision/sdk-js~5.8 kB9 kB
@emit-vision/sdk-react~0.9 kB2 kB

sdk-react is small because it re-exports sdk-js rather than bundling it. Both are tree-shakeable — unused exports are dropped by your bundler.

Configuration reference

All packages share these init() options.

OptionTypeDefaultDescription
apiKeystringYour ingest token — starts with evk_, safe to include in browser bundles
endpointstringOverride the ingest URL (self-hosted only)
environmentstringLabel for the deployment environment (production, staging, development)
releasestringApp version or git SHA — used to group errors by deploy
sessionIdstringBrowser session identifier; ties events into a session timeline
autoCapture.errorsbooleanfalseAuto-capture unhandled window errors
autoCapture.unhandledRejectionsbooleanfalseAuto-capture unhandled promise rejections
autoCapture.flagExposuresbooleantrueFire a $flag_exposure event for each flag evaluation
debugbooleanfalseLog SDK lifecycle events to console.debug
flushIntervalMsnumber5000Milliseconds between automatic flushes
batchSizenumber20Items in queue before an immediate flush is triggered
flagEvalTtlMsnumber60000In-memory cache TTL for flag evaluations

Batch compression

Event batches larger than 8 KB are automatically gzipped and sent with the Content-Encoding: gzip header. The API accepts both compressed and uncompressed bodies. If your environment does not support the standard CompressionStream API (some React Native runtimes, older polyfills), the SDK automatically falls back to sending uncompressed JSON — no configuration needed.

If you run the SDK behind a reverse proxy, WAF, or corporate middlebox and see ingest errors, confirm the proxy is configured to accept Content-Encoding: gzip or set endpoint to point directly to the Emit Vision API.