I’m wondering if you can really have as many subcategories as you want? Using subcategories with Analytics.RecordResources gives me “Submit events failed due to 400 BAD_REQUEST”. For example: Analytics.RecordResource(Player, 100, "Source", "Gold", "Mission", "DogeCleansing") prints out success but Analytics.RecordResource(Player, 100, "Source", "Gold", "Mission", "DogeCleansing:Hard") prints out failed.
Also, does the USD conversion work correctly? Is the math.floor intended? Right now, a 399 R$ transaction prints out 1 in json amount while 200 R$ transaction prints out 0.
I ran into that problem with business events and I found out that you can’t have subcategories with them, might be the same case for resources. I also noticed that the USD conversion puts the Robux value in dollars, but GameAnalytics looks for it in cents, so it just needs to be multiplied by 100.
In the ClientInit function, these lines of code worry me:
if Platform == "PC" then
local isWindows = guiService:IsWindows();
if isWindows then
OS = "windows";
else
OS = "mac";
end
end
Firstly, Platform can never be PC (the getPlatform() function never sets anything to "PC"), so the code will never run. Secondly, if it did run, it would break, because GuiService:IsWindows() is a non-existent method. What’s the purpose of this code being there?
Otherwise, I like this a lot. Using it for a new project.
read that code and laughed. While totally my fault for letting it in, I think that code was submitted by Velibor and then I just didn’t check it over lol.
The module needs a rewrite soon because of its shoddy error handling, and its a little too messy for my taste. If you see anything else like this, please post it.
The other issue I found was in the SubmitEvents function. In that function, the EventsResponse response is never decoded from the JSON string. Due to how strings work, it never actually errors, thus it just assumes the status code is always 200.
Also, it tries to set ResponseDictionary to EventsResponse.json(), which is a function call? Perhaps the parentheses aren’t supposed to be there? I’m not really sure what’s happening there, but it will always error, which is caught by pcall.
However, the ResponseDictionary is never used after it is returned, so it doesn’t actually break anything.
I’m trying to add this to my game, but the module doesn’t seem to be sending anything:
After waiting 20+ minutes I’m receiving nothing on my Game Analytics page.
(Note the ‘Analytics packet sent’ was my code calling .RecordResource. …no I dont know why I called it a packet either, I’ll change that… )
It’s by far the most accurate way we have. It would allow us to see which language users are imputing in, and hence where we should prioritize translation.
If you’re looking at abstracting the data, you could use timezones to roughly guess, and I suspect that’ll be far better than telling if Spanish or not. What are you planning on using that data for?