玩家統計資料 API 可針對特定玩家區隔和玩家生命週期的不同階段,打造專屬的遊戲體驗。您可以根據玩家的進度、消費和互動情形,為每個玩家區隔打造專屬的體驗。舉例來說,您可以使用這個 API 採取主動式動作,鼓勵較少活躍玩家再次參與遊戲,例如在玩家登入時顯示及宣傳新的遊戲內商品。
本指南說明如何在原生 C++ 或 Objective-C 應用程式中使用 Player Stats API。
玩家統計資料基本概念
您可以使用 Player Stats API 擷取玩家的遊戲內活動相關資料。可以擷取的玩家資料類型有:
- 平均工作階段長度:玩家平均工作階段長度,以分鐘為單位。工作階段長度以玩家登入 Google Play 遊戲服務的時間為準。
- 流失機率:預測未來一天是否會流失玩家,設為 0 (流失機率較低) 或 1 (流失機率高)。流失的定義是閒置的 7 天。
- 上次遊玩後經過的天數:玩家上次登入之後經過的大致天數。
- 購買次數:玩家進行應用程式內購的大致次數。
- 工作階段數量:玩家工作階段的大致數量。工作階段以玩家登入 Google Play 遊戲服務的次數為準。
- 工作階段百分位數:以 0 到 1 (含) 之間的小數值表示玩家的工作階段百分位數近似值。這個值表示目前玩家與其他遊戲玩家數量相比所玩的工作階段數。數字越高表示這名玩家玩過的工作階段越多。
- 消費百分位數:以 0 到 1 (含) 之間的小數值表示玩家的約略支出百分位數。這個值代表和遊戲其他玩家相較,目前玩家所消費的金額。數字越高表示這名玩家消費的越多。
透過 C++ 取得目前登入玩家的玩家統計資料
// Create the callback for our asynchronous fetch call. This callback will
// log either an error or the average session length for the currently
// signed-in player.
gpg::StatsManager::FetchForPlayerCallback callback = [](gpg::StatsManager::FetchForPlayerResponse const &response) {
if (IsError(response.status)) {
LogE("An error occurred fetching player stats.");
} else {
gpg::PlayerStats const & player_stats = response.data;
if (player_stats.HasAverageSessionLength()) {
LogI("Average session length: %f", player_stats.AverageSessionLength());
} else {
LogW("Currently signed-in player had no associated average session length stats.");
}
}
};
// Asynchronously fetch the Player Stats. When the fetch is finished it
// will call our callback. game_services_ is the std::unique_ptr<GameServices>
// returned by gpg::GameServices::Builder.Create()
game_services_->Stats().FetchForPlayer(callback);
為已登入的球員取得 Objective-C 的玩家統計資料
// Asynchronously fetches the Player Stats and then logs either a
// description of them or an error
[GPGPlayerStats playerStatsWithCompletionHandler:^(GPGPlayerStats *playerStats, NSError *error) {
if (error) {
NSLog(@"Error fetching player stats: %@", error);
} else {
NSLog(@"Description of stats for the currently signed-in player: %@", playerStats);
}
}];
玩家統計資料資料的使用訣竅
Play Stats API 可以讓您輕鬆根據玩家參與情形和消費行為辨別各種玩家類型,並採用合適的策略,以便讓玩家擁有更優質的遊戲體驗。
以下表格提供部分玩家族群範例,以及推薦的參與策略:
玩家族群 | 參與策略 |
---|---|
經常遊玩,且工作階段數量和消費百分位數都很高的玩家,但是沒玩遊戲的時間已經達到一個禮拜以上。 |
|
參與度高但是消費百分位數低的玩家。 |
|
高消費金額玩家,並出現已經過了高峰期,而且遊玩頻率開始下降的跡象。 |
|