When you add Firebase to your Play Game Services project in the Play Developer console, you can:
- Get access to Firebase Analytics, a free app measurement solution that provides insight on app usage and user engagement.
- View your Games events in the Firebase Analytics by logging Play Games events to Firebase.
When you add Firebase to your Play Games Services project, you’re also linking your Google Play Account to your Firebase project.
Add Firebase to your Play Games Services project
In the Play Developer Console:
- Click Add Firebase on the Game details page of your app
- Review the policy confirmation, then click Confirm
Now Firebase is added to your Play Games Project and your Google Play account is linked to your Firebase project. Next, you will need to add the Firebase SDK to your app's code.
Add the Firebase SDK to your app
To get started, add Firebase Analytics to your app.
Once you have added the Firebase Analytics SDK to your app, you can begin logging Play Games events. Here are some sample events you can log:
Bundle bundle = new Bundle(); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN, bundle);
Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.ACHIEVEMENT_ID, achievementId); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.UNLOCK_ACHIEVEMENT, bundle);
Scores on a leaderboard
Bundle bundle = new Bundle(); bundle.putLong(FirebaseAnalytics.Param.SCORE, score); bundle.putString("leaderboard_id", leaderboardId); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.POST_SCORE, bundle);
You can view the events logged in the Firebase Analytics dashboard. You can also access the Firebase console directly from the Play Developer Console by clicking the Firebase icon next to your app’s icon in the Game details page.
Troubleshooting common errors
Unable to view Play Games events in the Firebase Analytics dashboard
- Check that you have integrated Firebase Analytics.
- Verify that your code implements events for
- Verify the SDK is logging events by enabling verbose logging. Because devices batch events to preserve battery life, it can take some time before these events are visible in the Analytics dashboard.
Unable to link your Firebase project to Google Play
Unable to access the Firebase console from the Play Developer Console
The account you’re logged into Play Developer Console may not be added to the Firebase project. Check with the Firebase project owner to verify if your account has been added to the Firebase project via the Firebase console.