When you add Firebase to your Play Game Services project in the Google Play Console, you can:
- Get access to Google Analytics for Firebase, a free app measurement solution that provides insight on app usage and user engagement.
- View your Games events in the Analytics dashboard 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 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 Google Analytics for Firebase to your app.
Once you have added the Google Analytics for Firebase 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 Google Analytics for Firebase dashboard. You can also access the Firebase console directly from the Play 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 Google Analytics for Firebase dashboard
- Check that you have integrated Google Analytics for Firebase.
- 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 Console
The account you’re logged into Play 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.