Download the SDK
To install, please clone github repo or download
.zip from github file and use rojo to sync files into Roblox Studio. For more info on how to use Rojo read here.
To use wally, run the following command:
wally install gameanalytics
On the GameAnalytics Roblox module page click on the
Get button. Inside Roblox Studio, select
Workspace, open the
Toolbox and select
My Models and click on the
GameAnalytics module to add it to
Once the module has been installed inside Roblox Studio you need to do the following:
- Move the
GameAnalyticsscript (together with its children) under
- Move the Server script under
ServerScriptService(optional, not needed if you want to programmatically initialize the SDK from your own script)
- Move the Client script under
Now we should be ready for adding code to activate the SDK.
There are 2 phases you need to get started:
Configuration calls configure settings for the SDK and some will not be able to be altered after initialize has been called.
Initialize call will start the SDK and activate the first session. The configuration and initialization steps should be called when the application starts.
Once step 1 & 2 is done you can add events at different parts of the game code where some relevant action is happening.
The configuration phase happens before initialization is called. The available configuration options are listed here:
- custom user id
- available (allowed) custom dimensions
- available (allowed) resource currencies
- available (allowed) resource item types
Build is used to specify the current version of your game. Specify it using a string. Recommended to use a 3 digit version like
Custom user id
You can create a function (on client side) to use to create a custom user id for each user. Here is an example of a local function for custom user id:
local player = game.Players.LocalPlayer
local function getCustomUserId()
To enable custom user id you need to add this argument to when initializing the SDK:
useCustomUserId = true,
-- more settings
Specifying allowed values
For certain types it is required to define a whitelist containing possible unique values during the configuration phase. When the SDK is being used (after initialization) only the specified values will be allowed.
A maximum of 20 values are allowed for each list.
Processing many unique dimension values can be taxing for our servers. A few games with a poor implementation can seriously increase our cost and affect stability. Games will be blocked if they submit too many unique dimension values. We have this configuration requirement to guide users into planning what dimension values can be used.
Remember to add the following line to your script whenever you need to call the SDK:
local ReplicationStorage = game:GetService("ReplicationStorage")
-- using wally package
-- local GameAnalytics = require(ReplicationStorage.Packages.GameAnalytics)
-- using rojo or manually copied in
local GameAnalytics = require(ReplicationStorage.GameAnalytics)
Enable/disable event submission
If you for GDPR purposes need to disable event submission you can call the following:
By default event submission is of course enabled. You will still receive configs if you have set any for your game even after disabling event submission.
Initializing the SDK
In order to initialize the SDK you will have to call this from your script:
On player ready event
To listen to when a player is ready meaning they have gotten their player data loaded for them.
Create something like the below in another server script:
OnPlayerReadyEvent = OnPlayerReadyEvent or game:GetService("ReplicatedStorage"):WaitForChild("OnPlayerReadyEvent")
local function onPlayerReady(Player)
--Do stuff in here
It is also possible to call this function to ask if a player is ready:
local isPlayerReady = GameAnalytics:isPlayerReady(playerId)