Forest Logo
search
package_2

analytics

By @moxxum

Roblox

Mirrored

analytics

Event emitter over Roblox AnalyticsService (funnel + custom events) with a batching queue (default 20 calls/s, oldest-dropped beyond 500 queued) so bursts never blow the service's rate budget. Standard events built in: session_start, session_end (duration as value), funnel steps, purchase_prompted, purchase_completed, d1_flag. Optional external HTTP sink, off by default.

Server realm: Analytics = "moxxum/analytics@0.1.0" under [server-dependencies].

API

Analytics.Init(config?)  -- once; hooks session_start/session_end unless AutoSession = false
Analytics.Custom(player, name, value?, fields?)          -- fields: up to 3 strings
Analytics.FunnelStep(player, funnel, step, stepName?, fields?)
Analytics.PurchasePrompted(player, "product"|"pass", id)
Analytics.PurchaseCompleted(player, "product"|"pass", id, robuxSpent?)
Analytics.FlagD1(player, firstJoinUnix)  -- fires d1_flag once if 20-52h since first join

Config: AutoSession (default true), MaxQueue (500), FlushPerSecond (20), HttpSink = { Url, IntervalSeconds? } (posts JSON batches; only enable per-game, keys belong in Roblox secrets, never in git).

Funnel session IDs are managed internally per player+funnel; step == 1 starts a new funnel session. monetize wires purchase events via its callbacks:

Monetize.Init({
	GetProfile = DataKit.Get,
	OnPurchasePrompted = Analytics.PurchasePrompted,
	OnPurchaseCompleted = Analytics.PurchaseCompleted,
})

D1 instrumentation: store the first-join unix time in the datakit profile, call Analytics.FlagD1(player, profile:Get("FirstJoinAt")) after load.

Test

rojo build test.project.json -o test.rbxl, open in Studio, Play Solo, expect [analytics-test] ALL PASS (verifies queueing + drain; dashboard delivery can't be verified from Studio).

Package Details

Install command (Click to copy)


Version

0.1.0

License

MIT

check_circle

Safe for commercial use

infoThe package archive does not include its license text; the license is declared in its manifest metadata.

Automated license review — not legal advice.