question

rupinderkhatkar avatar image
rupinderkhatkar asked

Sessions and player data,Number of sessions per day by users

Hi I have been reading on how to create some charts ie sessions per day by user count. Do we have to download a different platform ie Appuri to see this data? I noticed there is a segment that counts all players, but why is this not in the data explorer section? Thanks!

Player Datadata
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rupinderkhatkar avatar image rupinderkhatkar commented ·

So I have used client_session_start to count the sessions and player_logged_in to count the users, but how would I now divide the two to see sessions per player? Firstly are those events correct?

0 Likes 0 ·
Xiao Zha avatar image
Xiao Zha answered

Since the "client_session_start" and "player_logged_in" events are generated every time the player calls the login method using the Unity SDK (according to Sessions - PlayFab | Microsoft Learn, currently only the Unity SDK supports session feature). So, if you want to display a chart representing the sessions per day by user count, you only need to use "client_session_start" to get the sessions count of each player which is also the number of times the player has logged in with Unity. And below is the KQL sentence.

  ['events.all']
  | where FullName_Name == "client_session_start"
  | where Timestamp  between (datetime(2023-03-13) .. datetime(2023-03-14))
  | summarize count() by Entity_Id,FullName_Name

Also, the Segment is for collecting players who meet certain conditions, while the Data Explorer is the main window for event data collected by your title and services, they serve different purposes, so they are not placed in the same section.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rupinderkhatkar avatar image rupinderkhatkar commented ·

Thank you for this! Where is the date within this output, ie I was expecting columns of date, number of sessions and number of players.

What event refers to 'date' in general?

Once the query is completed, is there a way to save this other than a table?

0 Likes 0 ·
rupinderkhatkar avatar image
rupinderkhatkar answered

I am trying this with no luck - I have taken the square brackets off for events.all also and this does not work

[events.all] | Timestamp |count() by Entity_Id | where FullName_Name == "client_session_start" | where Timestamp between (datetime(2023-03-13) .. datetime(2023-03-14)) | summarize count() by Entity_Id,FullName_Name

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Xiao Zha avatar image Xiao Zha commented ·

If you want a table with three columns, one for the date, one for the number of sessions, and one for the number of players, below is the KQL sentence you can directly copy and paste to the Data Explorer. Please do not take the square brackets off for events.all. And the KQL sentence you modified is incorrect, for more information about Kusto, you may refer to Getting started with Data Explorer advanced mode - PlayFab | Microsoft Learn and Tutorial: Kusto queries | Microsoft Learn.

 ['events.all']
 | where FullName_Name == "client_session_start" 
 | project format_datetime(Timestamp,'yyyy-MM-dd'),Entity_Id,FullName_Name
 | summarize PlayerNum=dcount(Entity_Id), SessionNum=count() by Timestamp

Also, currently, the completed table can only be export to CSV or Excel.

0 Likes 0 ·
rupinderkhatkar avatar image rupinderkhatkar Xiao Zha commented ·

this is great, I added another row to cap the days and added a chart, but I could not find exactly what format_datetime actually means from the online docs? Also could not find how to divide the 2 so I can get an average sessions per player.

['events.all'] | where FullName_Name == "client_session_start" | where Timestamp > ago(10d) | project format_datetime(Timestamp,'yyyy-MM-dd'),Entity_Id,FullName_Name | summarize Players=dcount(Entity_Id), NoSessions=count() by Timestamp | render columnchart

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha rupinderkhatkar commented ·

Since the format of the timestamp in the PlayFab event is like this: "2023-02-23T05:05:45.586Z", it contains hours, minutes and seconds, so in order to aggregate the data within a day, you need to use the format_datetime method to adjust the timestamp format. You can refer to format_datetime() - Azure Data Explorer | Microsoft Learn for more information.

If you want to add a column to display average sessions per player, here is the KQL sentence you can refer to:

 ['events.all']
 | where FullName_Name == "client_session_start" 
 | project format_datetime(Timestamp,'yyyy-MM-dd'),Entity_Id,FullName_Name
 | summarize PlayerNum=dcount(Entity_Id), SessionNum=count() by Timestamp
 | extend AverageSession=SessionNum/PlayerNum

Please note that the division here will be rounded down.

1 Like 1 ·
Show more comments
rupinderkhatkar avatar image
rupinderkhatkar answered

I am trying to figure out how to sum duration per run. So ideally the columns I would like to see would be day, count of players and sum of runs (duration). This is what I have so far, but I have an error: ['events.all'] | where FullName_Name == "on_run_ended_by_dying" | where Timestamp > ago(10d) | project format_datetime(Timestamp,'yyyy-MM-dd'),Entity_Id,FullName_Name,EventData | summarize Players=dcount(Entity_Id), Duration=sum(EventData._RunDuration) | extend sumBy = tolong(EventData._RunDuration) | render columnchart

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Xiao Zha avatar image Xiao Zha commented ·

I notice you have post a new thread, and my colleague will discuss with you in that thread.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.