API Reference
Tags & Context
Attach key-value tags to all future events from this session. Useful for filtering and segmenting in the dashboard.
setTag#
typescript
function setTag(
key: string,
value: string | number | boolean,
): void;Set a single tag. The tag is attached to every event sent from this point on.
typescript
import { setTag } from '@reliableapp/frontend-core';
setTag('plan', 'pro');
setTag('region', 'us-east-1');
setTag('app_version', '2.4.0');setTags#
typescript
function setTags(
tags: Record<string, string | number | boolean>,
): void;Merge-set multiple tags at once. Equivalent to calling setTag for each key, but cheaper:
typescript
import { setTags } from '@reliableapp/frontend-core';
setTags({
plan: 'pro',
region: 'us-east-1',
app_version: '2.4.0',
experiment_cohort: 'B',
});Lifecycle#
Tags persist for the lifetime of the session — they're attached to every event sent until either:
- The page is reloaded (a new session starts)
- The user is identified with a different
externalId(session rotates) - You overwrite the tag with a new
setTagcall (same key, new value)
Per-event tags#
For tags that apply to a single event only, pass them via captureException or captureMessage options. Per-event tags are merged over scope tags, with per-event values winning on conflict:
typescript
setTag('flow', 'general');
captureException(err, {
tags: { flow: 'checkout' }, // overrides 'general' for this event only
});
// Subsequent events still see flow='general' from scopeNaming conventions#
Tag keys aren't enforced, but a few conventions make dashboard filtering pleasant:
- Use
snake_casefor keys — consistent with the rest of the API. - Keep values short — they're rendered as filter chips in the UI.
- Use stable values, not unique IDs — tags are for grouping. Put unique values (user IDs, request IDs) in
traitsonidentify, or in event-specific data.
React users
Use the
useSetTag and useSetTags hooks for stable references inside components.