Using PlayFab Analytics
Using PlayFab Analytics
One of the easiest ways to monitor and improve your game post-launch is through articles/introduction to analytics|analytics, using the built-in AnalyticsService along with PlayFab.
PlayFab Setup
Obtaining an API Key
If you are part of the PlayFab beta, you’ll receive an email with a link to register an account. Once you’ve done so, log in to your PlayFab dashboard. You can find the API key for your game right below the game title.
Adding Users
To add more users from your PlayFab dashboard:
- Go to the main page of the dashboard.
- Click on the
icon to the right of the studio name and select Users from the dropdown. - On the next page, click ADD USER.
AnalyticsService Setup
To begin using AnalyticsService, you’ll need to set the API key as follows:
- In Roblox Studio, open the Command Bar from the View tab.
- Enter the following commands to set the
AnalyticsService/ApiKey|AnalyticsService.ApiKeyproperty (replaceAPI_KEYwith your unique API key). This will store the key to be sent with all future events.
Sending Events
AnalyticsService allows you to report custom in-game events, including anything from players choosing their favorite battlefield to how often they use one item/object over another.
To report a custom event to PlayFab, use the AnalyticsService/FireEvent|FireEvent() method from a Script or ModuleScript, specifying both a category and value. Note that the value passed can be either a string, number, or a table of values.
ModuleScript and convert it into a articles/roblox packages|package which can be quickly updated across every place in your game.
As you can see, analytics help you monitor player behavior and fine-tune the game experience. Now that you understand how to connect PlayFab, please explore fundamental concepts in the articles below.