Quick start
Install the SDK, add four lines to a server script and see your first event.
Before you start
- Get an ingestion key and a project ID for your game. The key stays in server-only code.
- In Roblox Studio open Game Settings → Security and turn on Allow HTTP Requests.
Add the SDK
Place the SDK folder at ServerScriptService.RoStructure. See Install the SDK.
Then create a server Script:
local ServerStorage = game:GetService("ServerStorage")
local RoStructure = require(game.ServerScriptService.RoStructure)
-- Keep secrets in ServerStorage (never ReplicatedStorage or the client).
local secrets = require(ServerStorage.RoStructureSecrets)
local analytics = RoStructure.init({
projectId = "my_game",
ingestionKey = secrets.ingestionKey,
buildId = "v" .. game.PlaceVersion,
endpoint = "https://api.rostructure.com",
})
-- Deaths, quits and sessions are tracked automatically.
-- Add your own milestones wherever they happen:
analytics:setStage(player, "stage_3")
analytics:track(player, "checkpoint_reached", { position = true })See your data
Publish a place version and play a session, then sign in to the dashboard. Data appears after the next flush, within 5 seconds by default.