0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AndroidでFirebaseとGoogle Analyticsのgoogle_service.jsonを共存させる

Last updated at Posted at 2019-04-04

Google Analytics(GA)をすでに入れているアプリで
Firebaseでイベントを取るために設定したのがGAが動かなくなったため
google_service.jsonを何処を変更したかのメモです

Firebaseから取得したgoogle_service.jsonをベースとして使います。
(中身は消してます)

google_service.json
{
  "project_info": {
  },
  "client": [
    {
      "client_info": {
        "android_client_info": {
        }
      },
      "oauth_client": [
        {
          "android_info": {
          }
        },
        {
        }
      ],
      "api_key": [
        {
        }
      ],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
            },
            {
              "ios_info": {
              }
            }
          ]
        },
        "ads_service": {
        }
      }
    }
  ],
  "configuration_version": "1"
}

GAから取得していた下記のgoogle_service.jsonを上のファイルで上書きするとGAは動かないので

google_service.json
{
  "project_info": {
  },
  "client": [
    {
      "client_info": {
        }
      },
      "oauth_client": [],
      "api_key": [
        {
        }
      ],
      "services": {
        "analytics_service": {
          "status": 2,
          "analytics_property": {
            "tracking_id": "UA-11111111-1"
          }
        },
        "appinvite_service": {
        },
        "ads_service": {
        }
      }
    }
  ],
  "configuration_version": "1"
}

ここだけメモっておく。

        "analytics_service": {
          "status": 2,
          "analytics_property": {
            "tracking_id": "UA-11111111-1"
          }
        },

Firebaseから取得したgoogle_service.jsonの下記の箇所に上書きするだけ。

        "analytics_service": {
          "status": 1
        },
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?