Using GameAnalytics (Retention and Monetisation) (Ez mode)

Thanks for making this.

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.

1 Like

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.

1 Like

Is there any way to convert it to any other type of currency or is it limited to USD?

1 Like

You can change currency in GameAnalytics settings and then edit price * 0.0035 in the module to whatever factor the new currency has

Edit: You might not need to edit the module, just settings. It says in their FAQ that they convert automatically.

1 Like

Alright thanks, that’s useful

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.

3 Likes

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.

4 Likes

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.

1 Like

I know for a fact this has been used in games with 100M+ visits, and this comes up like 8 months after I published it.

:+1:

Thanks though, super useful!

4 Likes

lol no problem! I think my co-workers hate me because I point out all this stuff to them in their code. I’ll post if I find anything else.

5 Likes

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… )

Edit: Derp, hadn’t run the client side code.

@kingdom5 think we can use this?

I plan on using the ordered data store to get the same idea as shown here but it will be slower.


I think I did something wrong. :frowning:

Edit: I fixed it lol

I would like to know what region my users come from by using SystemLocaleId. How would I go about implementing this?

This wouldn’t be an accurate metric.

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.

That doesn’t mean you can accurately deduce their region, only their language.

And that is valuable information we could use.

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?