Hello everyone, I was previously using Google Analytics, but the UA version will stop collecting data on July 1st. I couldn’t find the GA4 interface in both the ROBLOX official documentation and Google’s official documentation, so I decided to switch to GameAnalytics. However, I have followed the instructions in the documentation completely, but encountered a problem during the process. I was able to solve it through a post: All GameAnalytics calls erroring - Help and Feedback / Scripting Support - DevForum | Roblox, but I still cannot collect data successfully, nothing showed in my game report.
Here is my server:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- using wally package
--local GameAnalytics = require(ReplicatedStorage.Packages.GameAnalytics)
-- using rojo or manually copied in
local GameAnalytics = require(ReplicatedStorage.GameAnalytics)
GameAnalytics:setEnabledInfoLog(true)
GameAnalytics:setEnabledVerboseLog(true)
GameAnalytics:configureAvailableResourceCurrencies({"Gems"})
GameAnalytics:configureAvailableResourceItemTypes({"Gems", "test"})
GameAnalytics:configureBuild("0.1.0")
--GameAnalytics:initServer("fb39761579712621c22791879c1d0dc8", "2f7c6b9f0aac440631ae2add01399e98d82ef72d")
GameAnalytics:setEnabledEventSubmission(true)
GameAnalytics:setEnabledAutomaticSendBusinessEvents(true)
-- Configure build version
GameAnalytics:configureBuild("alpha 0.1.0")
-- Initialize
-- GameAnalytics:initserver(key1, key2) does the same thing
GameAnalytics:initialize({
gameKey = "fb39761579712621c22791879c1d0dc8", -- test key
secretKey = "2f7c6b9f0aac440631ae2add01399e98d82ef72d" -- test key
})
-- Add Design event
GameAnalytics:addDesignEvent({
eventId = "Some:Event"
})
GameAnalytics:addBusinessEvent(1, {
amount = 100,
itemType = "boost",
itemId = "megaboost",
cartType = "ingame"
})
GameAnalytics:addBusinessEvent(1, {
amount = 100,
itemType = "boost",
itemId = "megaboost",
cartType = "ingame"
})
GameAnalytics:addResourceEvent(1, {flowType = GameAnalytics.EGAResourceFlowType.Source, itemType = "test", itemId = "test", amount = 100, currency = "Gems"})
GameAnalytics:addDesignEvent(1, {
eventId= "TEST",
value = 10,
})
And here is the log:
15:11:08.746 Info/GameAnalytics: Info logging enabled - Server - Logger:28
15:11:08.746 Verbose/GameAnalytics: Verbose logging enabled - Server - Logger:86
15:11:08.746 Info/GameAnalytics: Set available resource currencies: (Gems) - Server - Logger:28
15:11:08.746 Info/GameAnalytics: Set available resource item types: (Gems, test) - Server - Logger:28
15:11:08.746 Info/GameAnalytics: Set build version: 0.1.0 - Server - Logger:28
15:11:08.746 Debug/GameAnalytics: Starting GA thread - Server - Logger:70
15:11:08.746 Info/GameAnalytics: Set build version: alpha 0.1.0 - Server - Logger:28
15:11:09.810 Info/GameAnalytics: Event submission enabled - Server - Logger:28
15:11:09.811 Info/GameAnalytics: Server initialization queue called #0 events - Server - Logger:28
15:11:09.811 Info/GameAnalytics: Event queue: No events to send - Server - Logger:28
15:11:09.811 ▶ Info/GameAnalytics: Added event to player initialization queue (x5) - Server - Logger:28
15:11:10.814 Info/GameAnalytics: Starting a new session. - Server - Logger:28
15:11:10.814 Debug/GameAnalytics: Sending 'init' URL: https://sandbox-api.gameanalytics.com/v2/5c6bcb5402204249437fb5a7a80a4959/init - Server - Logger:70
15:11:10.814 Debug/GameAnalytics: init payload: {"sdk_version":"roblox 2.2.2","os_version":"uwp_desktop 0.0.0","random_salt":0,"build":"alpha 0.1.0","session_num":0,"platform":"uwp_desktop","user_id":"3623697024"} - Server - Logger:70
15:11:11.746 Debug/GameAnalytics: init request content: {"enabled":true,"server_ts":1683961871,"flags":[]} - Server - Logger:70
15:11:11.747 Info/GameAnalytics: Remote configs populated - Server - Logger:28
15:11:11.747 Verbose/GameAnalytics: Event added to queue: {"sdk_version":"roblox 2.2.2","platform":"uwp_desktop","client_ts":1683961871,"device":"unknown","v":2,"session_id":"f8e7b640-60a5-4257-b41a-e2a8849a3728","os_version":"uwp_desktop 0.0.0","user_id":"3623697024","category":"user","session_num":1,"manufacturer":"unknown","country_code":"GB","build":"alpha 0.1.0"} - Server - Logger:86
15:11:11.747 Info/GameAnalytics: Add SESSION START event - Server - Logger:28
15:11:11.747 Info/GameAnalytics: Event queue: Sending 1 events. - Server - Logger:28
15:11:11.747 Debug/GameAnalytics: Sending 'events' URL: https://sandbox-api.gameanalytics.com/v2/5c6bcb5402204249437fb5a7a80a4959/events - Server - Logger:70
15:11:12.030 Debug/GameAnalytics: body: {} - Server - Logger:70
15:11:12.030 Info/GameAnalytics: Event queue: 1 events sent. - Server - Logger:28
15:11:18.048 ▶ Info/GameAnalytics: Event queue: No events to send (x5) - Server - Logger:28
15:11:58.515 Info/GameAnalytics: Event queue: No events to send - Server - Logger:28
Could you please point out what the problem might be?