Skip to content

Quickstart Guide

Create a Script inside ServerScriptService (e.g. ServerScriptService/AnalyticsRunner.server.luau):

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnalyticsModule = require(ReplicatedStorage:WaitForChild("AnalyticsModule"))
-- Initialize with debug mode enabled for local Studio testing
local Analytics = AnalyticsModule.init({
debugMode = true, -- Prints formatted event batches to output
autoTrackSessions = true, -- Measures playtime and AFK states
autoTrackServerUptime = true, -- Monitors memory, uptime, and server FPS
autoTrackBadges = true, -- Hooks badge completions
enableRetentionTracking = true, -- Tracks D1/D7/D30 cohorts via DataStore
autoTrackDeaths = true, -- Logs player death coordinates
autoTrackDemographics = true, -- Profiles client platform & input mode
})
print("Analytics Module initialized!")

Create a LocalScript inside StarterPlayerScripts (e.g. StarterPlayerScripts/AnalyticsClient.client.luau):

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnalyticsModule = require(ReplicatedStorage:WaitForChild("AnalyticsModule"))
-- Automatically boots client performance, demographics, and error forwarding
local AnalyticsClient = AnalyticsModule.init()
-- Fire a custom client event (e.g., UI interactions)
AnalyticsClient:track("MenuOpened", { menuName = "Shop" })

With debugMode = true, you will see structured output in the Studio Output Window:

[RealisticAnalytics] --- Batch of 4 Event(s) ---
[1] (server) ServerInit -> {"jobId":"","placeId":0,"placeVersion":0}
[2] (session) SessionStart [User: 123456] -> {"accountAgeDays":120,"locale":"en_us"}
[3] (demographics) ClientDemographics [User: 123456] -> {"platform":"PC","inputDevice":"KeyboardMouse","networkPingMs":35}
[4] (server) ServerHeartbeat -> {"uptimeSeconds":60,"memoryUsageMb":312,"heartbeatFps":60}
[RealisticAnalytics] ---------------------------------------------