Events

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:

  1. Define events. To define new events to capture in your game:
    1. Go to the Events page for your game in the Google Play Console.
    2. Click on the Add new event button and configure the event properties.
    3. Publish your event definitions by following the steps described in Publishing your game changes.
  2. 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.

  3. 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:

  • "Zombies Killed"
  • "Red Gems Collected"
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:

Premium currency source
Select this type for events that track sources of a premium currency. For example:
  • “Gold coins earned”
  • “Emeralds bought”
Premium currency sink
Select this type for events that track sinks, or consumption, of a premium currency. For example:
  • “Gold coins spent”
  • “Emeralds used”

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:

  1. Add your game in Google Play Console, if you have not already done so.
  2. In Google Play Console, click on the Game services icon on the left and select the entry for your game.
  3. Select the Events tab on the left, and click on the Add event button.
  4. Fill in the details for the event you want to create.
  5. 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:

  1. In 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.
  2. Make your edit changes.
  3. When you've finished editing the event, click the Save button.
  4. 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: