{"id":"moxxum/analytics","name":"analytics","scope":"moxxum","platform":"roblox","description":"Batched AnalyticsService emitter: session/funnel/purchase/d1 standard events, optional HTTP sink","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["The package archive does not include its license text; the license is declared in its manifest metadata."],"licenseVerified":false,"dependencies":{},"integrity":"d1a19dbd7bfe324d2e117b3948e2c1de9198c2d77fee833010d0fa7e1e08893c","likes":0,"downloads":0,"install":"forest install moxxum/analytics","url":"https://forest.dev/p/roblox/moxxum/analytics","files":"https://api.forest.dev/ai/package/roblox/moxxum/analytics/files","readme":"# analytics\n\nEvent emitter over Roblox `AnalyticsService` (funnel + custom events) with a batching\nqueue (default 20 calls/s, oldest-dropped beyond 500 queued) so bursts never blow the\nservice's rate budget. Standard events built in: `session_start`, `session_end`\n(duration as value), funnel steps, `purchase_prompted`, `purchase_completed`,\n`d1_flag`. Optional external HTTP sink, **off by default**.\n\nServer realm: `Analytics = \"moxxum/analytics@0.1.0\"` under `[server-dependencies]`.\n\n## API\n\n```lua\nAnalytics.Init(config?)  -- once; hooks session_start/session_end unless AutoSession = false\nAnalytics.Custom(player, name, value?, fields?)          -- fields: up to 3 strings\nAnalytics.FunnelStep(player, funnel, step, stepName?, fields?)\nAnalytics.PurchasePrompted(player, \"product\"|\"pass\", id)\nAnalytics.PurchaseCompleted(player, \"product\"|\"pass\", id, robuxSpent?)\nAnalytics.FlagD1(player, firstJoinUnix)  -- fires d1_flag once if 20-52h since first join\n```\n\nConfig: `AutoSession` (default true), `MaxQueue` (500), `FlushPerSecond` (20),\n`HttpSink = { Url, IntervalSeconds? }` (posts JSON batches; only enable per-game, keys\nbelong in Roblox secrets, never in git).\n\nFunnel session IDs are managed internally per player+funnel; `step == 1` starts a new\nfunnel session. `monetize` wires purchase events via its callbacks:\n\n```lua\nMonetize.Init({\n\tGetProfile = DataKit.Get,\n\tOnPurchasePrompted = Analytics.PurchasePrompted,\n\tOnPurchaseCompleted = Analytics.PurchaseCompleted,\n})\n```\n\nD1 instrumentation: store the first-join unix time in the datakit profile, call\n`Analytics.FlagD1(player, profile:Get(\"FirstJoinAt\"))` after load.\n\n## Test\n\n`rojo build test.project.json -o test.rbxl`, open in Studio, Play Solo, expect\n`[analytics-test] ALL PASS` (verifies queueing + drain; dashboard delivery can't be\nverified from Studio).\n","readmeTruncated":false}