@glyphhq/browser sends events from a web app. It queues messages in memory, sends them in batches, and attempts a flush when the tab is hidden or the connection returns.
Install
init, profile, track, group, page, flush, and reset on window.Glyph. The npm package additionally exports the GlyphBrowser class and singleton helpers such as getClient.
The SDK reports its package name and version with each request. Glyph stores this as diagnostic metadata alongside the write key used for ingestion. It is not added to event properties.
Browser write keys are public credentials. They can ingest events but cannot read data. Use a
glyph_test_... key during development so test events stay separate from live customer data.Initialize
Create a client directly, or useinit to share a singleton across the app:
init() again disposes the previous singleton and discards its queued messages. reset() disposes it without creating a replacement; call it on logout.
See Configuration & delivery for all constructor options. The browser client adds one of its own:
Identify customers with profile
Call profile when a customer signs up or logs in, or when a profile trait changes. userId is the stable identity key, and every profile must include email.
Record actions with track
Record page views with page
The browser SDK exposes page for client-side page views:
{}.
Record account context with group
group records a group/account event on the customer’s timeline. Glyph does not currently create a separate account record or provide group-level analytics.
Flushing
Messages queue locally and flush when the queue reachesflushAt (default 20), on the flushIntervalMs timer (default 5 s), or when autoFlush fires on tab hide or reconnect. You can also force it:
Known customers only
Every method takesuserId as its first argument. Glyph does not support anonymous identities; begin tracking after signup or another point where the customer is known.