Markers
This API is used to send engagement markers from the browser.
For more information about Markers, visit the Markers Guide.
const gamebeastMarkers = gamebeast.markers;Markers are batched and sent in the background. Each marker is validated when you send it: properties must be a plain JSON-serializable object, such as { level: 3 }, and are copied immediately, so changing the object afterwards doesn't affect the marker. An invalid marker is dropped with an error in the log rather than throwing, so one bad marker never fails a batch.
Failed sends are retried with exponential backoff. Rejections the backend won't accept on a retry (an invalid marker, a bad key) are logged and dropped.
Markers are attributed to the current user and session automatically. When the session landed through a Gamebeast deeplink or a UTM link, every marker also carries that attribution: see Deeplink attribution.
They're sent in batches of 10, or every 10 seconds. When the page is hidden or closed, buffered markers go out with fetch keepalive, so they survive the page unloading. If the browser is offline, they're saved to localStorage and sent when the connection returns or on the next visit.
send(eventName, properties?, options?)
voidreturn type
Records a marker for the current user and session.
eventNamestringThe name of the marker, e.g. "level_completed".
propertiesRecord<string, unknown>The marker's data, as a plain JSON-serializable object. Optional.
options.serverIdstringThe server unit the marker belongs to, for server-level experiments, such as the team or
workspace the user is acting in. Omitted by default. 1–128 characters; a malformed value is
dropped with a warning and the marker is still sent. Requires @gamebeast/js 1.1.0.
Usage
gamebeastMarkers.send("RoundEnded", { Score: 600, Map: "Office", Duration: 120 });
// Attributed to the workspace the user is acting in
gamebeastMarkers.send("report_shared", {}, { serverId: String(workspace.id) });flush()
Promise<void>return type
Sends everything buffered now. Resolves once the requests have settled.