Using GameAnalytics (Retention and Monetisation) (Ez mode)


#42

Thanks for all your feedback! I’ve updated the module and improved the tutorial


#43

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.


#44

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.


#45

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


#46

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.


#47

Alright thanks, that’s useful


#48

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.


#49

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.


#50

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.


#51

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!


#52

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.


#53

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.


#54

@kingdom5 think we can use this?


#55

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


#56


I think I did something wrong. :frowning:

Edit: I fixed it lol


#57

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


#58

This wouldn’t be an accurate metric.


#59

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.


#60

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


#61

And that is valuable information we could use.