Skip to content

Analytics SDK

Install the SDK

One server ModuleScript, one secret, one line to start. Sessions and game pass purchases are tracked for you.

1. Add the module

The module must live somewhere only the server can see, such as ServerScriptService. Pick the way you already work:

  • Model file: download it from your experience's Integration page in shipLua (the API address is filled in) and drag it into ServerScriptService.
  • Wally: add shipLua to your server dependencies and run wally install. The package goes live on the Wally index with the first public SDK release; until then use the model or Rojo.
  • Rojo: map the SDK folder into ServerScriptService.
wally.toml
[server-dependencies]
ShipLua = "shiplua/shiplua@0.2.0"
default.project.json (excerpt)
{
  "ServerScriptService": {
    "ShipLua": { "$path": "Packages/ShipLua" }
  }
}

Then turn on Allow HTTP Requests under Experience Settings > Security.

2. Store the key as a secret

  1. In shipLua, open the experience, then Integration > Keys. Create a LIVE key for real servers and a TEST key for Studio.
  2. In the Creator Hub, open the experience, then Secrets > Create Secret. Name it ShipLuaIngestKey, paste the LIVE key and limit the domain to your shipLua API host.
  3. For Studio, add a local secret with the same name and the TEST key. Test events show in the live debugger but never in your charts.

3. Start it

Server Script
-- ServerScriptService/Analytics.server.luau
local ShipLua = require(game:GetService("ServerScriptService").ShipLua)

ShipLua.Init({ Build = "1.0.0" })

game.Players.PlayerAdded:Connect(function(player)
	local coins = ShipLua:GetConfig(player, "StartingCoins", 100)
	ShipLua:TrackResource(player, "Source", "Coins", coins, "Reward", "Starter")
end)

Play in Studio. The Integration page moves from “Waiting for first event” to “Receiving test events” within a few seconds. Publish with the LIVE secret and it shows “Receiving events”.

Options

Endpoint, Build, Debug, TrackErrors, TrackPerformance, AutoTrackSessions, AutoTrackGamePasses, RemoteConfig, FlushSeconds, MaxQueueSize and ShutdownBudgetSeconds. Next: Track events.