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.
Integrate 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:
- Go to the Events page for your game in the Google Play Console.
- Click the Add new event button and configure the event properties.
- Publish your event definitions by following the steps described in Publishing your game changes.
Implement event capturing in your game using the events APIs. For example, in your Android code, call the events
increment
method 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 Google Play Console to view statistics for the captured events.
Event basics
The events APIs provide you with a way to define and collect interesting gameplay metrics and upload these metrics to Play Games SDK.
A Play Games SDK event contains these key properties:
Property | Description |
---|---|
ID | A unique string generated by Google Play Console for this event. Use this unique ID to refer to the event in your game clients. |
Name | A short name of the event. The name can be up to 100 characters.
This value is used by Google Play Console and can be displayed in
your game.
Examples:
|
Description | 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 Google Play Console and can be displayed in your game. |
Event type |
A field that declares the type of data the event is tracking. This value is used by Google Play Console to support Player Analytics reporting. Two event types are supported:
|
Icon | A square icon that will be associated with your event. |
Create an event
To create a new event for your game, follow these steps:
- In the Google Play Console, click the Game services icon on the left and select the entry for your game.
- Select the Events tab on the left, and click 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.
Edit 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.
Delete an event
You can delete events that are in draft state or that have been published. To delete an event in Google Play Console, click the button labeled Delete at the bottom of the form for that event.
Reset event data
You can reset player progress data for testers of your events.
- To reset draft events in 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
Events
methods.
Client implementations
To learn how to implement events for your platform, see the following resources: