Integrate Firebase with your Play Games services project

Firebase can help level up your game:

  • Log Games events with Google Analytics, a free app measurement solution that provides insight on app usage and user engagement.

  • Use any of the Firebase products that support games, like Crashlytics, Remote Config, and more.

Get started

  1. If you haven't already, create a Firebase project, and then add Firebase to your game (C++ | Unity).

  2. Link your Firebase app to your Google Play developer account. This same link will be used by your Play Games services project.
    In the Firebase console, go to the Integrations tab. On the Google Play card, click Link, and then follow the on-screen instructions to create the link.

  3. Make sure that your app in Google Play is set up to use Play Games services.

Log Games events using Google Analytics

  1. Add Google Analytics to your app.

  2. Once you've added the Firebase SDK for Google Analytics to your app, you can begin logging Play Games events. Here are some sample events you can log:

    • Login events

      Bundle bundle = new Bundle();
      mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN, bundle);
      
    • Unlock achievements

      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);
      
  3. You can view the logged events in the Analytics dashboard of the Firebase console.

    You can also access the Firebase console from the Play Console by clicking the Firebase icon next to your app’s icon in the Game details page.

Troubleshooting common errors

Cannot view Play Games events in the Analytics dashboard

You need to link Google Play to Firebase using the Firebase console ( > Project settings > Integrations > Google Play). If you're having trouble linking, check the following:

Cannot access the Firebase console from the Play Console

Make sure that your Google Play developer account is linked to a Firebase app. In the Play Console, an Owner or Admin of the Play developer account can view the linking status under Setup > Linked Services > Firebase.