The Google Play Games events service allows you to collect cumulative data generated by your players during gameplay and store them in Google's servers for game analytics. You can flexibly define what player data your game should collect; this might include metrics such as how often:
- Players use a particular item
- Players reach a certain level
- Players perform some specific game action
You can use the events data as feedback on how to improve your game. For example, you can adjust the difficulty level of certain levels in your game that players are finding too hard to complete.
To learn how to implement events for your platform, see Client implementations.
Integrating events in your game
The following workflow describes how you can apply events in your game:
- Define events. To define new events to capture in your game:
Implement event capturing in your game using the events APIs. For example, in your Android code, call the events
incrementmethod whenever your game detects that an event that it cares about has been triggered.
View events data. Go to the Events page for your game in the Google Play Console to view statistics for the captured events.
The events APIs provide you with a way to define and collect interesting gameplay metrics and upload these metrics to Google Play games services.
A Google Play games services event contains these key properties:
|A unique string generated by the Google Play Console for this event. Use this unique ID to refer to the event in your game clients.
|A short name of the event. The name can be up to 100 characters.
This value is used by the Google Play Console and can be displayed in your game.
|A longer description of the event (for example, "Number of times a player has killed a zombie" or "The total number of red gems the player has eliminated and matched"). The description can be up to 500 characters. This value is used by the Google Play Console and can be displayed in your game.
A field that declares the type of data the event is tracking. This value is used by the Google Play Console to support Player Analytics reporting.
Two event types are supported:
|A square icon that will be associated with your event.
Creating an event
To create a new event for your game, follow these steps:
- Add your game in the Google Play Console, if you have not already done so.
- In the Google Play Console, click on the Game services icon on the left and select the entry for your game.
- Select the Events tab on the left, and click on the Add event button.
- Fill in the details for the event you want to create.
- Click Save. If there are no errors, your event is placed in the "Ready to publish" state. You can now proceed to publish your game changes.
Editing an event
To edit an event that you've created:
- In the Google Play Console, open the Events tab and select the entry for the event you want to edit. You should see the same form you used when creating the event.
- Make your edit changes.
- When you've finished editing the event, click the Save button.
- Test your game to verify the modified event. If it is working correctly, republish your game changes.
Deleting an event
You can delete events that are in draft state or that have been published. To delete an event in the Google Play Console, click the button labeled Delete at the bottom of the form for that event.
Resetting event data
You can reset player progress data for testers of your events.
- To reset draft events in the Google Play Console, click the button labeled Reset event progress at the bottom of the form for that event.
- To reset event data programmatically, call
the Management API
To learn how to implement events for your platform, see the following resources: