SDK
Browser SDK
GalyaSDK watches the DOM for data-galya-* attributes, runs a tracker per component, and batches events to your ingest URL. Snapshots (via rrweb) are optional per element.
import { GalyaSDK, galyaDefaultEventsEndpoint } from "@galya/sdk";
const galya = new GalyaSDK({
endpoint: galyaDefaultEventsEndpoint(),
apiKey: process.env.GALYA_API_KEY!,
userId: "user_123",
workspaceId: "ws_…", // galya_pub_…
batchSize: 10,
flushIntervalMs: 3000,
onEvent: (e) => console.debug(e),
onBatch: ({ result, error }) => error && console.warn(error),
});
galya.identify("user_456"); // after login
await galya.flush();
galya.destroy(); // teardown + final send| Option | Default | Notes |
|---|---|---|
captureContent | true | rrweb snapshot on exit |
batchSize | 10 | flush when queue fills |
flushIntervalMs | 3000 | periodic flush |
- Instrumentation — HTML attributes on cards, listings, feeds
- Batching — when and how events POST