Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
A seguito del ritiro dell'API Google Sign-in, rimuoveremo l'SDK di Google Play Services per i giochi v1 nel 2026. Dopo febbraio 2025, non potrai pubblicare su Google Play titoli appena integrati con l'SDK v1 per i giochi. Ti consigliamo di utilizzare invece l'SDK giochi v2.
Sebbene i titoli esistenti con le integrazioni precedenti della versione 1 dei giochi continuino a funzionare per un paio di anni, ti invitiamo a eseguire la migrazione alla versione 2 a partire da giugno 2025.
Questa guida è dedicata all'utilizzo dell'SDK Play Services v1. L'SDK C++ per la versione 2 dei servizi per i giochi di Google Play non è ancora disponibile.
L'API Statistiche dei giocatori ti consente di personalizzare le esperienze di gioco in base a segmenti specifici di giocatori e a diverse fasi del loro ciclo di vita. Puoi creare esperienze personalizzate per ogni segmento di giocatori in base al loro avanzamento, alle loro spese e al loro coinvolgimento. Ad esempio, puoi utilizzare questa API per intraprendere azioni proattive per incoraggiare un giocatore meno attivo a interagire nuovamente con il tuo gioco, ad esempio mostrando e promuovendo nuovi articoli in-game quando il giocatore accede.
Questa guida mostra come utilizzare l'API Statistiche giocatore in un'applicazione nativa C++ o
Objective-C.
Nozioni di base sulle statistiche dei giocatori
Puoi utilizzare le API Player Stats per recuperare i dati sull'attività in-game di un giocatore. I tipi di dati dei giocatori che puoi recuperare includono:
Durata media della sessione: la durata media della sessione del player in
minuti. La durata della sessione è determinata dal momento in cui un giocatore accede ai servizi per i giochi di Google Play.
Probabilità di abbandono dell'utente: la previsione di un abbandono da parte di un utente il giorno successivo, indicata come 0 (probabilità bassa di abbandono) o 1 (probabilità elevata di abbandono). Il tasso di abbandono viene calcolato in base a 7 giorni di inattività.
Giorni dall'ultima partita: il numero approssimativo di giorni dall'ultima partita del giocatore.
Numero di acquisti: il numero approssimativo di acquisti in-app per il
giocatore.
Numero di sessioni: il numero approssimativo di sessioni del player.
Le sessioni sono determinate dal numero di volte in cui un giocatore accede ai servizi per i giochi di Google Play.
Percentile delle sessioni: l'approssimazione del percentile delle sessioni per il
giocatore, dato come valore decimale tra 0 e 1 (inclusi). Questo valore indica quante sessioni ha giocato il
giocatore corrente rispetto al resto della base di giocatori
del gioco. Numeri più elevati indicano che questo giocatore ha completato più sessioni.
Percentile di spesa: il percentile di spesa approssimativo del giocatore, fornito come valore decimale compreso tra 0 e 1 (inclusi). Questo valore indica quanto ha speso il giocatore corrente rispetto al resto della base di giocatori del gioco. Numeri più elevati indicano che questo giocatore ha speso di più.
Recuperare le statistiche di un giocatore che ha eseguito l'accesso con 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::FetchForPlayerCallbackcallback=[](gpg::StatsManager::FetchForPlayerResponseconst&response){if(IsError(response.status)){LogE("An error occurred fetching player stats.");}else{gpg::PlayerStatsconst & 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);
Ottenere le statistiche di un giocatore che ha eseguito l'accesso con Objective-C
// Asynchronously fetches the Player Stats and then logs either a// description of them or an error[GPGPlayerStatsplayerStatsWithCompletionHandler:^(GPGPlayerStats*playerStats,NSError*error){if(error){NSLog(@"Error fetching player stats: %@",error);}else{NSLog(@"Description of stats for the currently signed-in player: %@",playerStats);}}];
Suggerimenti per l'utilizzo dei dati delle statistiche dei giocatori
L'API Play Stats ti consente di identificare facilmente vari tipi di giocatori in base al loro coinvolgimento e al loro comportamento di spesa e di applicare strategie appropriate per migliorare la loro esperienza di gioco.
La tabella seguente elenca alcuni esempi di segmenti di giocatori e strategie di coinvolgimento consigliate:
Segmento di giocatori
Strategia di coinvolgimento
Giocatori frequenti con un numero elevato di sessioni e un buon percentile di spesa, ma che non hanno giocato nell'ultima settimana o più.
Inviare una notifica relativa a uno sconto o un bonus speciale
disponibile al loro ritorno in gioco.
Mostra un messaggio di benvenuto che riconosce risultati impressionanti e assegna un badge progettato per incoraggiare il ritorno.
Giocatori altamente coinvolti in un percentile di spesa basso.
Personalizza i bonus per incentivarli a invitare i loro amici
a installare e giocare al tuo gioco. Questo approccio si basa sul divertimento dimostrato dal giocatore per reclutare nuovi giocatori.
Giocatori con una spesa elevata che mostrano segni di aver raggiunto il picco e di iniziare
a giocare meno di frequente.
Personalizza i bonus per rinnovare il loro interesse, ad esempio
offrendo strumenti, armi o sconti di alto valore e di breve durata.
La volta successiva che il giocatore accede, mostra un video che lo indirizza alle funzionalità della community, come gli attacchi ai clan, che stimolano un coinvolgimento più frequente e prolungato.
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-27 UTC."],[],[],null,["# Add player stats to your game\n\nFollowing the deprecation of the\n[Google Sign-In](https://android-developers.googleblog.com/2024/09/streamlining-android-authentication-credential-manager-replaces-legacy-apis.html)\nAPI, we are removing the games v1 SDK in 2026. After February 2025, you will be unable to publish\ntitles that are newly integrated with games v1 SDK, on Google Play. We recommend that you use the\ngames v2 SDK instead. \n\nWhile existing titles with the previous games v1 integrations continue to function for a\ncouple of years, you are encouraged to\n[migrate to v2](/games/pgs/android/migrate-to-v2)\nstarting June 2025. \n\nThis guide is for using the Play Games Services v1 SDK. The C++ SDK for\nPlay Games Services v2 is not yet available.\n\nThe Player Stats API let you tailor game experiences to specific segments of\nplayers and different stages of the player lifecycle. You can build tailored\nexperiences for each player segment based on how players are progressing,\nspending, and engaging. For example, you can use this API to take proactive\nactions to encourage a less active player to re-engage with your game, such as\nby displaying and promoting new in-game items when the player signs in.\n\nThis guide shows you how to use the Player Stats API in a native C++ or\nObjective-C application.\n\nPlayer stats basics\n-------------------\n\nYou can use the Player Stats APIs to retrieve data about a player's in-game\nactivity. The types of player data you can retrieve include:\n\n- **Average session length**: The average session length of the player in minutes. Session length is determined by the time that a player is signed in to Google Play Games services.\n- **Churn probability**: The prediction of whether a player will churn in the next day, given as 0 (low probability of churn) or 1 (high probability of churn). Churn is defined as 7 days of inactivity.\n- **Days since last played**: The approximate number of days since the player last played.\n- **Number of purchases**: The approximate number of in-app purchases for the player.\n- **Number of sessions**: The approximate number of sessions of the player. Sessions are determined by the number of times that a player signs in to Google Play Games services.\n- **Session percentile**: The approximation of sessions percentile for the player, given as a decimal value between 0 and 1 (inclusive). This value indicates how many sessions the current player has played in comparison to the rest of this game's player base. Higher numbers indicate that this player has played more sessions.\n- **Spend percentile**: The approximate spend percentile of the player, given as a decimal value between 0 and 1 (inclusive). This value indicates how much the current player has spent in comparison to the rest of this game's player base. Higher numbers indicate that this player has spent more.\n\nGet player stats for a currently signed-in player with C++\n----------------------------------------------------------\n\n // Create the callback for our asynchronous fetch call. This callback will\n // log either an error or the average session length for the currently\n // signed-in player.\n gpg::StatsManager::FetchForPlayerCallback callback = [](gpg::StatsManager::FetchForPlayerResponse const &response) {\n if (IsError(response.status)) {\n LogE(\"An error occurred fetching player stats.\");\n } else {\n gpg::PlayerStats const & player_stats = response.data;\n if (player_stats.HasAverageSessionLength()) {\n LogI(\"Average session length: %f\", player_stats.AverageSessionLength());\n } else {\n LogW(\"Currently signed-in player had no associated average session length stats.\");\n }\n }\n };\n // Asynchronously fetch the Player Stats. When the fetch is finished it\n // will call our callback. game_services_ is the std::unique_ptr\u003cGameServices\u003e\n // returned by gpg::GameServices::Builder.Create()\n game_services_-\u003eStats().FetchForPlayer(callback);\n\nGet player stats for a currently signed-in player with Objective-C\n------------------------------------------------------------------\n\n // Asynchronously fetches the Player Stats and then logs either a\n // description of them or an error\n [GPGPlayerStats playerStatsWithCompletionHandler:^(GPGPlayerStats *playerStats, NSError *error) {\n if (error) {\n NSLog(@\"Error fetching player stats: %@\", error);\n } else {\n NSLog(@\"Description of stats for the currently signed-in player: %@\", playerStats);\n }\n }];\n\nTips for using player stats data\n--------------------------------\n\nThe Play Stats API lets you easily identify various types of players, based on\ntheir engagement and spending behavior, and apply appropriate strategies to\nenhance their game experience.\n\nThe following table lists some example player segments and recommended\nengagement strategies:\n\n| Player Segment | Engagement Strategy |\n|---------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Frequent players with a high number of sessions and good spend percentile, but have not played for the last week or more. | - Send a notification about a discount or special bonus available upon their return to play. - Show a welcome back message that acknowledges impressive accomplishments, and award a badge designed to encourage return play. |\n| Highly engaged players in a low spend percentile. | - Tailor bonuses to incentivize them to invite their friends to install and join your game. This approach builds on the player's demonstrated enjoyment of the game to recruit new players. |\n| High spending players showing signs of having peaked and starting to play less frequently. | - Tailor bonuses to freshen their interest, such as by offering high-value, short-duration tools, weapons, or discounts. - The next time the player signs in, show a video that directs them to community features, like clan attacks, that drive more frequent and longer engagement. |"]]