Analytics: Track any custom event you want and use custom fields for segmentation

It’s in live game server and private game

Is there any errors in the console? Also maybe the game being private cancels any Analytics? I am not sure.

I’ve also had issues getteing this to work, I’ve had this in here since this announcement first went out, and yet my events on the site are empty.

local PLR = game:GetService("Players")
local ANS = game:GetService("AnalyticsService")
local player = PLR.LocalPlayer

... (below is in the event that fires when the teleport button is pressed)

print(currentMap.shortName)
ANS:LogCustomEvent(player, currentMap.shortName)
print('sent')

image

This is in a live, public game. I’ve refreshed the events on the site multiple times and nothing comes up, there’s no error, so I’m pretty confused on why its not doing anything.

UPDATE

So after posting this I had a hunch that it might only work server-side, so I did that and I actually got an error:
29 - 18-04-28

Okay, so I fixed the strings and tried again. No error. Refreshed the events on the site and it’s there!

I did not realize that this was server-side only, I reread the annoucement and the docs and either it’s not mentioned or I’m very blind, either way I’m putting this here in case anyone else had the same issues. Server side only, filter out punctuation chars. Would be nice to see this mentioned on the docs (if it isnt already, i may have just missed it)

2 Likes

Hi! We’ve just rolled out an update to fix this issue. You should now be able to send events on player remove without additional changes.

Ok, so I have it working, but how do I remove all the other custom events that I’ve already logged

They will automatically go away in 90 days. Cardinality limits are also calculated daily so once you stop sending the old events they won’t count towards your limit.

1 Like

Hey, one last thing: Is it possible to filter by two custom fields at a time, but instead of requiring both, can the data shown be either? For example, I’m also logging the bricks recipes, like Energy + Red = Ash. The recipes can be in either order (Red + Energy = Ash.) If I wanted to compare the rarities of bricks created with Energy, I would need to filter Custom Field 1 & 2 to be Energy, but that would only show bricks made with Energy + Energy. Essentially, is there a way to make the filtering by “or” instead of “and”?

Unfortunately not right now - we’re still exploring options that would allow more free form queries. I’d recommend ordering the recipes before sending them so it’s deterministic or building your custom fields in a different way e.g. you could send HasEnergy as custom field 3.

I am not entirely sure if it just bugged, but I had a Custom Event go through without a custom_field_1 value.

Here is my code:

AnalyticsService:LogCustomEvent(
	Player,
	"ItemObtained",
	1,
	{
		[Enum.AnalyticsCustomFieldKeys.CustomField01.Name] = "Item Name: " .. MusicName,
		[Enum.AnalyticsCustomFieldKeys.CustomField02.Name] = "Item Type: Music",
		[Enum.AnalyticsCustomFieldKeys.CustomField03.Name] = "Obtainment Method: Shop"
	}
)

Here is what I got in return:

{
“user_id”: “1234567890”,
“event_name”: “ItemObtained”,
“value”: “1”,
“custom_field_1”: “”,
“custom_field_2”: “Item Type: Music”,
“custom_field_3”: “Obtainment Method: Shop”
}

As you can see, my custom_field_1 value is just totally blank when my script should not even being letting that happen in the first place? Anyways, everything has been working great other than this. (I replaced the UserId for privacy reasons)

Hey, that’s me! Yes, it seems like it. Gamebeast’s features include a lot more than just custom events, also heatmaps, A/B testing, remote configurations, audience segmentation, cross-game insights, and more offerings to empower developers. It looks like Roblox won’t be releasing any of those for at least a year and our larger ecosystem of tools aims to support Roblox developers in optimizing their games and let them get back to creating great content rather than fighting the algorithm.

Oh. Since you’re here. Would you like to collaborate with me?

I could use some… uh… economic moat for my machine and deep learning libraries for Roblox. You can view them here:

DataPredict

DataPredict Neural

1 Like

You can join our server to learn more and get access to all of these features!

Hi! Are you still having this issue? I would recommend double checking the value of MusicName and if it contains any invalid characters e.g. '. Feel free to message me if you’re still having issues!

Even if the value somehow was nil (which it wasn’t, it was part of a shop validation script on the server), shouldn’t it still at least show the text "Music Name: "?

Anyways, I only had this issue twice, and then it worked fine from that point on. When sorting by custom_field_1 in my custom analytics, it appeared as N/A in the graphs.

Some feedback on the custom events: I use them to log the intial load times for players, however the charts aren’t proving very useful for this usecase.

  • It rounds all values to the nearest integer, which is not good when logging loadtimes that are sometimes measured in milliseconds. The above shown chart is the overall client loadtime, the more granular charts I made like individual module loadtimes have times <1s meaning the charts are useless.
  • I can only aggregate by average and average per unique user. It would be great to sort by percentiles like P99 or P50 so I can see the actual range of values rather than a single number to represent a huge variety of edge cases.

Otherwise these custom events are VERY useful and pretty robust so far.

2 Likes

I also just made the same “mistake” that I recorded passing rate with naked float e.g. 0.11, 0.45, etc.
and the points in graph would just shown either 0 or 1

I had to multiply my rate with 100 to make the graph labels meaningful

1 Like

Are integers not allowed as custom field values? I’ve been logging integers as the custom field values for a few days and don’t have the ability to break the custom events down by custom field. But the custom events themselves show up fine.

i.e.

AnalyticsService:LogCustomEvent(
  Player,
  LogName,
  Value,
  {
    [Enum.AnalyticsCustomFieldKeys.CustomField01.Name] = 1,
    [Enum.AnalyticsCustomFieldKeys.CustomField02.Name] = 2,
  }
)

yes apparently custom field values only support string.
and this is not documented

1 Like

Can confirm, strings work but passing in a number of any kind is silently ignored/dropped.

I’m making a session data system what only can be edited on the server and the client can call a callback function to get data from the session data table not sure if I safely can edit the valeus with remote events I need to check it but don’t want to rate limit remote events but btw when the server fails to save the session data to datastore I want to send a custom event with their session data to manually edit important data

Is it possible to sent an table trough the custom event or an Json encoded table but at least it sends the player session data table

local plrSesionData = https:JSONEncode(sesionData.PlayerData[userId])
			warn(err)
			AS:LogCustomEvent(
				plr, 
				"DataSaveFailed", 
				0, 
				{
					[Enum.AnalyticsCustomFieldKeys.CustomField01.Name] = plrSesionData,
					[Enum.AnalyticsCustomFieldKeys.CustomField02.Name] = err
				}
			)

so this just ignore the json string

tested it with removing an argument by setasynch