Analytics SDK
Luau SDK overview
What the Bloxlytics Luau modules do, how they are built, and where to go next.
The Bloxlytics Luau SDK is two server-only ModuleScripts you add to your experience. They are optional: with only a Universe ID linked, Bloxlytics already shows Roblox's own numbers (see data sources). Install the SDK when you want player-level analytics, your in-game economy, funnels, live servers and remote Cmdr commands.
| Module | What it does | Key it uses |
|---|---|---|
Analytics |
Sends sessions, server heartbeats, economy, purchases, funnels, progression, player properties, experiment exposures and your custom events | Write key, bxw_… |
CmdrBridge |
Lets permitted team members run your game's registered Cmdr commands, macros, kicks and warnings from Bloxlytics | Bridge key, bxb_… |
Download both from Bloxlytics → your project → SDK, in the Installation section. The current version of both modules is 1.0.0 (Analytics.Version and CmdrBridge.Version).
#What the analytics module does
Once you call Analytics:Start, the module:
- starts a session for every player who joins and ends it when they leave, recording username, display name, account age, Premium, locale, country or region and whether they teleported in;
- sends a server heartbeat about every 30 seconds with the player count, the player list, the maximum players, your server tags and whether the Cmdr bridge is active;
- records game pass prompts (attempts and completions) and developer product prompts (attempts);
- fetches remote configuration from Bloxlytics on start and every 5 minutes, so you can switch tracking on and off, change batching, define currencies, block events and run experiments without publishing;
- closes every open session and flushes the queue when the server shuts down.
Everything else is one call away: custom events, economy, purchases, funnels and progression, player properties and experiments. The full list of what is sent on its own is on automatic events.
#Server only
Both modules run only on the server. Analytics:Init and Analytics:Start refuse to run anywhere else, with the warning The SDK only runs on the server; require it from a server Script.
Keep tracking server-authoritative
Never expose the tracking functions through a RemoteEvent or RemoteFunction. If a client can call TrackCurrencyEarned or record a purchase, an exploiter can fill your dashboards with made-up numbers. Call the SDK from the server code that actually grants currency, items and products.
The write key can only submit events and fetch the SDK's remote configuration. It cannot read your analytics and it is not a Roblox Open Cloud key. Even so, keep both keys in server-only scripts or, better, in experience secrets.
#Fail-soft design
The SDK is written so that a problem with Bloxlytics can never break your game.
- Bad configuration never throws.
Startchecks the configuration, prints one warning such as[Bloxlytics] Not started: WriteKey must start with bxw_ (use the write key, not an Open Cloud or bridge key). Your game keeps running without analytics.and returnsfalse. Every tracking call after that does nothing. - Bad calls never throw. A tracking call with a wrong argument (an invalid event name, a negative amount, a missing player) is dropped with a warning. Each distinct warning is printed only once per server, so a call inside a loop can't flood your output.
- Tracking calls don't yield. Calls such as
TrackEventonly add an event to an in-memory queue; the network work happens on the SDK's own thread. The exceptions are spelled out in the reference:Flushsends immediately, andWrapProcessReceiptmay look up a product name the first time it sees a product. - Network failures are retried. Failed sends are retried with exponential backoff, and the queue is bounded so a long outage can't use up the server's memory. See delivery.
- The bridge is separate. A Cmdr bridge problem only turns remote commands off; analytics keeps running, and the other way round.
#How the module works
The analytics module keeps four pieces of state on each server: a queue of events, one session per player, the latest remote configuration and your server tags.
- A call adds an event to the queue. Each event gets a random id, a timestamp in Unix seconds, and, when you pass a player, their user id and current session id. The queue holds at most 5,000 events; when it is full the oldest event is dropped.
- A loop runs once a second. It sends a heartbeat when 30 seconds have passed, starts a remote configuration refresh when 5 minutes have passed, and flushes when the flush interval has passed or the queue holds a full batch.
- A flush sends batches. Each request to
POST /v1/ingestcarries up to the maximum batch size (200 by default, 500 at most), along with this server's id, place id, place version, private server id and whether it is Studio. See send events. - The API validates each event. Valid events are stored; invalid ones are rejected one by one and listed in the Debugger on the SDK page. One bad event never costs the rest of its batch.
- Remote configuration is applied as it arrives.
GET /v1/configreturns the dashboard's settings and the experiments that are running. See remote configuration.
Each server has one id, Analytics.ServerKey. In a live server it is game.JobId; in Studio, which has no JobId, it is a per-session key such as studio-1a2b3c4d. The Cmdr bridge uses the same id, so analytics and commands refer to the same server.
#Where next
Add the module, store your keys and send your first events.
Every field you can pass to Start, with defaults.
What the SDK sends without any code from you.
Track anything that matters in your game.
Currency sources, sinks, balances and transfers.
Developer products and game passes, with ProcessReceipt.
Assign players to variants consistently, in game.
Every public function on the Analytics module.
Run your registered Cmdr commands from Bloxlytics.