I’ve been trying to use the GameAnalytics SDK for a project i’m working on to move away from discord webhooks. I’ve tried submitting this sample error through a Server Script:
GameAnalytics:addErrorEvent('AbnormalActivity', {
severity = GameAnalytics.EGAErrorSeverity.Info,
message = "This is a test info message for GameAnalytics"
})
However I get this response in the server output: Warning/GameAnalytics: Could not add error event SDK is disabled
Why is this happening? I have the game + secret key in the settings module.
After looking at the code and documentation, it seems like the first parameter should be a player ID. (player.UserId) you put ‘AbnormalActivity’.
function ga:addErrorEvent(playerId, options)
threading:performTaskOnGAThread(function()
if not state:isEventSubmissionEnabled() then
return
end
if not isSdkReady({playerId=playerId, needsInitialized=true, shouldWarn=true, message="Could not add error event"}) then
return
end
-- Send to events
local severity = options["severity"] or 0
local message = options["message"] or ""
events:addErrorEvent(playerId, severity, message)
end)
end
This code returns the error, so it seems to be that you’re forwarding the wrong parameter.
-- Is SDK enabled
if needsInitialized and playerId and not state:isEnabled(playerId) then
if shouldWarn then
logger:w(message .. " SDK is disabled")
end
return false
end
Thanks for clearing this up! Managed to get two incomimg evenrs registered on the site, now I just gotta wait for them to come through and appear on the log
Could be that it takes time, or you may have to close the session (game/studio run session) before it posts if it has a shutdown hook. Or if the player leaves and ends their session.
Edit:
Seems like there’s session events for starting/ending so it may only log things after the session of said player ends.