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:
import { GamebeastClient } from "@gamebeast/js";
const gamebeast = new GamebeastClient({ apiKey: "abcd-efgh-1234-5678" });
gamebeast.markers.send("example_marker", { value: 42 });| Service | What it does in the browser |
|---|---|
| Configs | Values evaluated for the current user |
| Markers | Attributed to the current user and session |
| Experiments | The current user's assignments |
| Cohorts | Is the current user a member? |
| Attribution | The 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.