Events
Events are the core unit of analytics in Emit Vision. Every captureEvent() call creates an event record with a name, properties, tags, and context — queryable in the dashboard.
Capturing an event
import { captureEvent } from "@emit-vision/sdk-js";
captureEvent("checkout_completed", {
plan: "pro",
seats: 5,
billing: "annual",
});Event naming conventions
Use snake_case with a verb_noun pattern. Consistent naming makes events easier to find and group in the dashboard.
| Good | Avoid |
|---|---|
user_signed_up | UserSignedUp, signup |
page_view | pageView, viewed page |
checkout_completed | Checkout, done |
button_clicked | click, btn_click |
Properties vs tags vs context
The captureEvent() signature accepts three distinct buckets for data:
captureEvent(
"feature_enabled",
{ featureName: "dark-mode" },
{
tags: {
experiment: "onboarding-v3",
variant: "dark-first",
},
context: {
route: "/settings",
trigger: "toggle-switch",
},
},
);| Field | Purpose | When to use |
|---|---|---|
properties | The event's own data | What happened: plan name, seat count, form values |
tags | Indexed metadata for filtering | High-cardinality: feature flags, A/B variants, release channels |
context | Ambient environment info | Where it happened: route, trigger, referrer |
Put values you'll filter on frequently — feature flags, experiment variants —
in tags. They're indexed differently and make dashboard queries faster.
Adding ambient context
Instead of repeating the same tags on every call, use setContext() and setTags() once:
import { setContext, setTags } from "@emit-vision/sdk-js";
// After login:
setContext({ userId: "user_123", orgId: "org_456" });
setTags({ plan: "pro", experiment: "new-nav" });
// Now every event automatically includes these
captureEvent("page_view", { path: "/dashboard" });What you see in the dashboard
The Events tab shows a live stream of captured events. Each event shows:
- Name and timestamp
- Properties, tags, and context
- User identification (if
identify()was called) - Session link (if
sessionIdwas set) - Release label (if
releasewas set at init)
Querying events
The dashboard lets you filter events by name, property values, tags, user, session, release, and time range. Use the Explore view to build ad-hoc queries.
Reserved event names
Events starting with $ are reserved for internal SDK use:
| Name | When it fires |
|---|---|
$flag_exposure | After each evaluateFlags() call (can be disabled) |
$error | Unhandled errors auto-captured by autoCapture |
$session_start | First event in a session |