Lancelot
Lancelot

Reputation: 1441

Android Using Firebase Analytics along with Google Analytics

I'd love to know how I can use Firebase Analytics (FA) and Google Analytics (GA) simultaneously as FA doesn't provide real-time data and my apps already integrated with GA since the beginning. I'd like to continue using GA since all my analytic data started there when I first launched my apps. Meanwhile, I'd like to have my apps have FA integrated to get more info.

I followed Using Firebase Analytics and Google Analytics together and setup Google Tag Manager. It doesn't seem to be working for me. I do see FA dashboard being updated but nothing is showing up in GA.

Any help is greatly appreciated!

Upvotes: 16

Views: 11899

Answers (4)

malhobayyeb
malhobayyeb

Reputation: 2883

Here is a sample of common XML/Plist taken from Firebase:

What I have done to obtain this file:

1- Implemented Google Analytics for Android and created a project in Google API Console, then

2- Implemented Google Analytics for iOS linked to the same Google API project, then

3- Created Firebase Project based on the same Google API project.

XML Config file for Android:

{
  "project_info": {
    "project_number": "MYAPP_PROJECT_NUMBER",
    "firebase_url": "MYAPP_FIREBASE_URL",
    "project_id": "MYAPP_PROJECT_ID",
    "storage_bucket": "MYAPP_STORAGE_BUCKET"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "MYAPP_MOBILESDK_APP_ID",
        "android_client_info": {
          "package_name": "MYAPP_PACKAGE_NAME"
        }
      },
      "oauth_client": [
        {
          "client_id": "MYAPP_CLIENT_ID_STARTING_WITH_PROJECT_NUMBER_1",
          "client_type": 1,
          "android_info": {
            "package_name": "MYAPP_PACKAGE_NAME",
            "certificate_hash": "MYAPP_CERT_HASH"
          }
        },
        {
          "client_id": "MYAPP_CLIENT_ID_STARTING_WITH_PROJECT_NUMBER_2_DIFFERENT_THAN_OAUTH_CLIENT_ID_ABOVE",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "MYAPP_CURRENT_KEY"
        }
      ],
      "services": {
        "analytics_service": {
          "status": 2,
          "analytics_property": {
            "tracking_id": "MYAPP_TRACKING_ID_FROM_GOOGLE_ANALYTICS"
          }
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "ads_service": {
          "status": 2
        }
      }
    }
  ],
  "configuration_version": "1"
}

Plist Config file for iOS:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>AD_UNIT_ID_FOR_BANNER_TEST</key>
    <string>MYAPP_AD_UNIT_ID_FOR_BANNER_TEST</string>
    <key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
    <string>MYAPP_AD_UNIT_ID_FOR_INTERSTITIAL_TEST</string>
    <key>TRACKING_ID</key>
    <string>MYAPP_TRACKING_ID</string>
    <key>CLIENT_ID</key>
    <string>MYAPP_CLIENT_ID</string>
    <key>REVERSED_CLIENT_ID</key>
    <string>MYAPP_REVERSED_CLIENT_ID</string>
    <key>API_KEY</key>
    <string>MYAPP_CURRENT_KEY</string>
    <key>GCM_SENDER_ID</key>
    <string>MYAPP_PROJECT_NUMBER</string>
    <key>PLIST_VERSION</key>
    <string>1</string>
    <key>BUNDLE_ID</key>
    <string>MYAPP_BUNDLE_ID</string>
    <key>PROJECT_ID</key>
    <string>MYAPP_PROJECT_ID</string>
    <key>STORAGE_BUCKET</key>
    <string>MYAPP_STORAGE_BUCKET</string>
    <key>IS_ADS_ENABLED</key>
    <true/>
    <key>IS_ANALYTICS_ENABLED</key>
    <true/>
    <key>IS_APPINVITE_ENABLED</key>
    <false/>
    <key>IS_GCM_ENABLED</key>
    <true/>
    <key>IS_SIGNIN_ENABLED</key>
    <true/>
    <key>GOOGLE_APP_ID</key>
    <string>MYAPP_MOBILESDK_APP_ID</string>
    <key>DATABASE_URL</key>
    <string>MYAPP_FIREBASE_URL</string>
</dict>
</plist>

Upvotes: 2

Cuong Nguyen
Cuong Nguyen

Reputation: 1176

In FireBase console, don't CREATE NEW APP, just IMPORT GOOGLE APP. Let import your current google analytic's app. Then replace your old config file by new firebase's config file. Enjoy!

Upvotes: 3

Steve Ganem
Steve Ganem

Reputation: 10851

You should use the google-services.json that is supplied for your app in the Firebase console. If this is missing your GA tracking ID, you can supply it manually either in your call to newTracker or as a string resource.

Upvotes: 16

djabi
djabi

Reputation: 5767

You can safely use Firebase Analytics and Google Analytics side-by-side in both Android and iOS apps.

Upvotes: 0

Related Questions