GamebeastDocs
Dashboard
JavaScript SDKAPI Reference

API Overview

All Gamebeast services are properties on the GamebeastClient instance: configs, markers, experiments and cohorts.

Every service is a property on the GamebeastClient you created:

markers.ts
import { GamebeastClient } from "@gamebeast/js";

const gamebeast = new GamebeastClient({ apiKey: "abcd-efgh-1234-5678" });

gamebeast.markers.send("example_marker", { value: 42 });
ServiceWhat it does in the browser
ConfigsValues evaluated for the current user
MarkersAttributed to the current user and session
ExperimentsThe current user's assignments
CohortsIs the current user a member?
AttributionThe deeplink or UTM campaign the session came from

All public types are exported for TypeScript users:

import type { ClientConfigs, ConfigPath, JsonValue } from "@gamebeast/js";

Unsubscribing

Methods that register a callback (observe, onChanged, onReady, onAssignmentsChanged) return an Unsubscribe function. Call it to stop receiving callbacks, for example when a component unmounts:

useEffect(
  () => gamebeast.configs.observe("game-settings.Banner", (banner) => setBanner(banner)),
  []
);

A callback that throws is logged and never stops other callbacks from running.

On this page