I rewrote my GameAnalytics module from ages ago to make it a little easier to use and included some preset functions to make it easier to track players.
Basic Info
This module by default tracks players joining, players leaving, developer product purchases and gamepass purchases (ones that are made in-game, if a player buys a gamepass on the website it won’t track it). It also tracks what platform the player is on (desktop, console or mobile), how many times they’ve played and how many transactions they made in-game. If you want to track anything else, like how many times a player died or how much money they earn/spend, you can use custom events. Learn how to do that at the bottom of the post.
How to setup
Step 1
Take the module from here: GameAnalytics Module V3 - Roblox and insert it into ServerStorage. You don’t want the client having access to the module at all because why would you
Step 2
Go to GameAnalytics.com and make an account if you haven’t already. Once you make an account, add a game to it and get the GameKey and SecretKey from it because you will need those (https://gameanalytics.com/docs/account-management)
Step 3
Once you have it in ServerStorage, put a script in ServerScriptService. Put this code in that script it makes it work:
local GameAnalytics = require(game.ServerStorage.GameAnalytics)
GameAnalytics:Init("PasteYourGameKeyRightHere", "AndPasteYourSecretKeyHere")
Step 4
That’s pretty much it set up now you can call GameAnalytics:SendEvent() to send custom events or if your more basic you can use the preset functions and here is an example of that (again this is already included in the module). If you decide to use the presets, sessions and transactions are already tracked and saved you just need to slightly modify the Presets module inside the GameAnalytics module if you want to save some other stuff it’s pretty easy.
There’s a premade server script and client script in the Module now, you can read it to find out how to properly set it up. It tracks what platform the player is on (desktop, console or mobile) and tracks developer product and gamepass purchases made in-game.
And here is how to send custom events
GameAnalytics:SendEvent({
["category"] = "design",
["event"] = "Game:RoundStart",
["value"] = 1,
})
If you want a custom event to be tied to a specific player, just pass the player object as the second argument and it’ll automatically fill in the data.
GameAnalytics:SendEvent({
["category"] = "design",
["event"] = "Game:KilledPlayer",
["value"] = 1,
}, game.Players.PlayerThatKilledSomeone)
If you find any bugs or something that’s wrong or there is something you want added just lmk and i’ll probably add it in
Changes
- Added automatic error reporting on the server. You could add client error reporting aswell but it could be spammed so I wouldn’t recommend it. If you do decide to you can just call
GameAnalytics:ReportError(ErrorMessage)