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](https://developer.android.com/games/pgs/events#implement-event).

## Integrate 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](https://play.google.com/apps/publish/).
   2. Click the *Add new event* button and configure the [event properties](https://developer.android.com/games/pgs/events#event-basics).
   3. Publish your event definitions by following the steps described in [Publishing your game changes](https://developer.android.com/games/pgs/console/publish).
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.

   | **Note:** On mobile clients, Play Games SDK updates events in batches, so you will see cumulative, rather than fine-grained, changes to your events. When using the REST API, implement your own batching to avoid sending event updates too frequently, as this might cause you to quickly exceed your [rate limits](https://developer.android.com/games/pgs/quota).
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"* <br /> |
| **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. In the [Google Play Console](https://play.google.com/apps/publish/), click the **Game services** icon on the left and select the entry for your game.
2. Select the **Events** tab on the left, and click the **Add event** button.
3. Fill in the details for the event you want to create.
4. 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](https://developer.android.com/games/pgs/console/publish).

### Edit an event

To edit an event that you've created:

1. In the [Google Play Console](https://play.google.com/apps/publish/), 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](https://developer.android.com/games/pgs/console/publish).

### 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](https://developer.android.com/games/services/management/api/events).

## Client implementations

To learn how to implement events for your platform, see the following resources:

- [Android](https://developer.android.com/games/pgs/android/events)
- [Web](https://developer.android.com/games/services/web/api/rest#rest-resource:-events)