Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Dịch vụ sự kiện Google Play Games cho phép bạn thu thập dữ liệu
tích lũy do người chơi tạo ra trong lúc chơi, sau đó lưu trữ chúng vào máy chủ của Google để phân tích trò chơi. Bạn có thể xác định linh hoạt loại dữ liệu người chơi mà trò chơi của bạn sẽ thu thập; Dữ liệu này có thể bao gồm các chỉ số chẳng hạn như tần suất:
Người chơi sẽ sử dụng một mục cụ thể
Người chơi đạt đến một cấp nhất định
Người chơi thực hiện một số thao tác cụ thể trong trò chơi
Bạn có thể sử dụng dữ liệu sự kiện như phản hồi về cách cải thiện trò chơi của mình. Ví dụ như bạn có thể điều chỉnh độ khó của một số cấp độ trong trò chơi mà người chơi thấy quá khó để hoàn thành.
Để tìm hiểu cách triển khai sự kiện cho nền tảng của bạn, vui lòng xem bài viết
Triển khai ứng dụng.
Tích hợp sự kiện vào trò chơi
Quy trình sau đây mô tả cách bạn có thể áp dụng sự kiện trong trò chơi của mình:
Xác định các sự kiện. Cách xác định các sự kiện mới để nắm bắt trò chơi:
Triển khai tính năng ghi lại sự kiện trong trò chơi bằng các API sự kiện. Chẳng hạn như trong mã Android, hãy gọi phương thức sự kiện increment bất cứ khi nào trò chơi phát hiện sự kiện mà nó quan tâm đã được kích hoạt.
Xem dữ liệu sự kiện. Hãy truy cập vào trang Sự kiện cho trò chơi của bạn trong
Google Play Console để xem số liệu thống kê cho các sự kiện được ghi lại.
Kiến thức cơ bản về sự kiện
Các API sự kiện cho phép bạn xác định và thu thập các chỉ số về lối chơi hay, đồng thời tải các chỉ số này lên SDK Play Games.
Sự kiện SDK Play Games chứa các thuộc tính chính sau:
Thuộc tính
Mô tả
Mã nhận dạng
Một chuỗi duy nhất do Google Play Console tạo cho sự kiện này.
Hãy dùng mã nhận dạng duy nhất này để tham chiếu đến sự kiện trong ứng dụng trò chơi của bạn.
Tên
Tên ngắn của sự kiện. Tên sự kiện có thể chứa tối đa 100 ký tự.
Google Play Console sẽ sử dụng giá trị này và có thể hiển thị trong trò chơi của bạn.
Ví dụ:
"Giết chết thây ma"
"Thu thập ngọc đỏ"
Mô tả
Nội dung mô tả dài hơn về sự kiện (ví dụ: "Số lần người chơi đã tiêu diệt thây ma" hoặc "Tổng số ngọc đỏ mà người chơi đã loại bỏ và khớp".) Mô tả có thể chứa tối đa 500 ký tự.
Google Play Console sẽ sử dụng giá trị này và có thể hiển thị trong trò chơi của bạn.
Loại sự kiện
Một trường khai báo loại dữ liệu mà sự kiện đang theo dõi.
Google Play Console sẽ sử dụng giá trị này để hỗ trợ tính năng báo cáo Phân tích người chơi.
Dưới đây là hai loại sự kiện được hỗ trợ:
Nhận tiền dùng trong trò chơi
Chọn loại này cho các sự kiện theo dõi nguồn của đơn vị tiền tệ cao cấp. Ví dụ:
"Số tiền vàng kiếm được"
"Mua ngọc lục bảo"
Chi tiêu tiền dùng trong trò chơi
Chọn loại này cho các sự kiện theo dõi bồn lưu trữ dữ liệu, hoặc mức tiêu thụ của đơn vị tiền tệ cao cấp. Ví dụ:
"Số tiền vàng đã chi tiêu"
"Số ngọc lục bảo đã sử dụng"
Biểu tượng
Một biểu tượng hình vuông sẽ được liên kết với sự kiện của bạn.
Tạo sự kiện
Để tạo sự kiện mới cho trò chơi của bạn, hãy làm theo các bước sau:
Trong Google Play Console, hãy nhấp vào biểu tượng Dịch vụ trò chơi ở bên trái rồi chọn mục cho trò chơi của bạn.
Chọn thẻ Sự kiện ở bên trái rồi nhấp vào nút Thêm sự kiện.
Điền thông tin chi tiết cho sự kiện mà bạn muốn tạo.
Nhấp vào Lưu. Nếu không có lỗi nào, sự kiện của bạn sẽ được đặt ở trạng thái
"Sẵn sàng phát hành". Giờ thì bạn đã có thể phát hành các thay đổi đối với trò chơi.
Chỉnh sửa sự kiện
Cách chỉnh sửa một sự kiện mà bạn đã tạo:
Trong Google Play Console, hãy mở thẻ Sự kiện rồi chọn mục nhập cho sự kiện mà bạn muốn chỉnh sửa. Bạn sẽ thấy nó cùng một biểu mẫu bạn đã dùng khi tạo sự kiện.
Chỉnh sửa thông tin bạn muốn.
Khi đã chỉnh sửa xong sự kiện, bạn hãy nhấp vào nút Lưu.
Bạn có thể xóa các sự kiện đang ở trạng thái bản nháp hoặc đã được phát hành. Để xoá một sự kiện trong Google Play Console, hãy nhấp vào nút có nhãn Xoá ở cuối biểu mẫu của sự kiện đó.
Đặt lại dữ liệu sự kiện
Bạn có thể đặt lại dữ liệu tiến trình của người chơi cho người thử nghiệm sự kiện của mình.
Để đặt lại các sự kiện nháp trong Google Play Console, hãy nhấp vào nút có nhãn Đặt lại tiến trình của sự kiện ở cuối biểu mẫu cho sự kiện đó.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[],[],null,["# Events\n\nThe Google Play Games events service allows you to collect cumulative\ndata generated by your players during gameplay and store them in Google's\nservers for game analytics. You can flexibly define what player data your game\nshould collect; this might include metrics such as how often:\n\n- Players use a particular item\n- Players reach a certain level\n- Players perform some specific game action\n\nYou can use the events data as feedback on how to improve your game. For\nexample, you can adjust the difficulty level of certain levels in your game\nthat players are finding too hard to complete.\n\nTo learn how to implement events for your platform, see\n[Client implementations](#implement-event).\n\nIntegrate events in your game\n-----------------------------\n\nThe following workflow describes how you can apply events in your\ngame:\n\n1. **Define events** . To define new events to capture in your game:\n 1. Go to the *Events* page for your game in the [Google Play Console](//play.google.com/apps/publish/).\n 2. Click the *Add new event* button and configure the [event properties](#event-basics).\n 3. Publish your event definitions by following the steps described in [Publishing your game changes](/games/pgs/console/publish).\n2. **Implement event capturing in your game using the events APIs** . For\n example, in your Android code, call the events `increment` method whenever\n your game detects that an event that it cares about has been triggered.\n\n | **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](/games/pgs/quota).\n3. **View events data** . Go to the *Events* page for your game in\n Google Play Console to view statistics for the captured events.\n\nEvent basics\n------------\n\nThe events APIs provide you with a way to define and collect interesting gameplay\nmetrics and upload these metrics to Play Games SDK.\n\nA Play Games SDK event contains these key properties:\n\n| Property | Description |\n|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **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. |\n| **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\"* |\n| **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. |\n| **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\"* \u003cbr /\u003e |\n| **Icon** | A square icon that will be associated with your event. |\n\n### Create an event\n\nTo create a new event for your game, follow these steps:\n\n1. 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.\n2. Select the **Events** tab on the left, and click the **Add event** button.\n3. Fill in the details for the event you want to create.\n4. 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](/games/pgs/console/publish).\n\n### Edit an event\n\nTo edit an event that you've created:\n\n1. 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.\n2. Make your edit changes.\n3. When you've finished editing the event, click the **Save** button.\n4. Test your game to verify the modified event. If it is working correctly, [republish your game changes](/games/pgs/console/publish).\n\n### Delete an event\n\nYou can delete events that are in draft state or that have been published. To\ndelete an event in Google Play Console, click the button labeled **Delete**\nat the bottom of the form for that event.\n\n### Reset event data\n\nYou can reset player progress data for testers of your events.\n\n- To reset draft events in Google Play Console, click the button labeled **Reset event progress** at the bottom of the form for that event.\n- To reset event data programmatically, call the [Management API `Events` methods](/games/services/management/api/events).\n\nClient implementations\n----------------------\n\nTo learn how to implement events for your platform, see the following resources:\n\n- [Android](/games/pgs/android/events)\n- [Web](/games/services/web/api/rest#rest-resource:-events)"]]