facebook twitter hatena line email

「Unity/Firebase/Analytics」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(サンプルイベント)
(サンプルイベント)
 
(同じ利用者による、間の5版が非表示)
行26: 行26:
  
 
<pre>
 
<pre>
 +
void AnalyticsLog()
 +
{
 
         Firebase.Analytics.FirebaseAnalytics
 
         Firebase.Analytics.FirebaseAnalytics
 
                 .LogEvent(Firebase.Analytics.FirebaseAnalytics.EventSelectContent,
 
                 .LogEvent(Firebase.Analytics.FirebaseAnalytics.EventSelectContent,
行31: 行33:
 
                           "title"
 
                           "title"
 
                 );
 
                 );
 +
}
 
</pre>
 
</pre>
  
行42: 行45:
  
 
==サンプルイベント==
 
==サンプルイベント==
スコア例
+
===スコア例===
 
<pre>
 
<pre>
 
Firebase.Analytics.FirebaseAnalytics.LogEvent(
 
Firebase.Analytics.FirebaseAnalytics.LogEvent(
行54: 行57:
 
);
 
);
 
</pre>
 
</pre>
 +
 +
===課金例===
 +
<pre>
 +
Firebase.Analytics.FirebaseAnalytics.LogEvent(
 +
          Firebase.Analytics.FirebaseAnalytics.EventAddPaymentInfo,
 +
          new Firebase.Analytics.Parameter[] {
 +
              new Firebase.Analytics.Parameter(
 +
                Firebase.Analytics.FirebaseAnalytics.ParameterPaymentType, "Month"),
 +
              new Firebase.Analytics.Parameter(
 +
                Firebase.Analytics.FirebaseAnalytics.ParameterCharacter, "taro"),
 +
          }
 +
        );
 +
</pre>
 +
 +
===カスタム項目===
 +
スネーク形式で書く。
 +
<pre>
 +
Firebase.Analytics.FirebaseAnalytics.LogEvent(
 +
            "hoge_column1",
 +
            new Firebase.Analytics.Parameter[] {
 +
              new Firebase.Analytics.Parameter(
 +
                "hoge_column1-1", "taro"),
 +
              new Firebase.Analytics.Parameter(
 +
                "hoge_column1-2", "jiro"),
 +
          }
 +
        );
 +
</pre>
 +
 +
==iosでanalyticsがカウントされない時==
 +
<pre>
 +
6.21.0 - <AppMeasurement>[I-ACS031025] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
 +
6.21.0 - <AppMeasurement>[I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
 +
6.21.0 - <AppMeasurement>[I-ACS025026] Deferring to Firebase for event data collection
 +
6.21.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
 +
6.21.0 - [Firebase/Analytics][I-ACS025028] AdMob and Firebase are in use in this app, but are not linked. For analytics data consistency and integrity, it is highly recommended that you link your AdMob app to the corresponding Firebase app and re-download the GoogleServices-Info.plist file. See https://support.google.com/admob/answer/6383165 for more information.
 +
6.21.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
 +
</pre>
 +
No pending snapshot to activate. SDK name: app_measurementらへん見るとappstoreに公開前だから出てこないのかもしれない。

2024年6月17日 (月) 13:40時点における最新版

Firebase設定

unity/Firebase/基本 [ショートカット]

Analyticsインストール

FirebaseAnalytics.unitypackageをAssets/Importからインストールする

androidのpermission追加

firebase-libraryを追加することで以下3つが追加された。

android.permission.WAKE_LOCK,
com.google.android.c2dm.permission.RECEIVE, 
com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE

公式Analytics

https://firebase.google.com/docs/analytics/unity/start?hl=ja

Admobを入れてる場合

Unity/GoogleMobileAds/初期設定 [ショートカット]

使い方

androidの場合

  1. unitypackageをImportしてれば、初期設定は不要だった。

iosの場合

  1. unitypackageをImportだけだとfirebase側に出なかった。
  2. 以下のLogEventを追加することで、出た。
void AnalyticsLog()
{
        Firebase.Analytics.FirebaseAnalytics
                .LogEvent(Firebase.Analytics.FirebaseAnalytics.EventSelectContent,
                          Firebase.Analytics.FirebaseAnalytics.ParameterContentType,
                          "title"
                );
}

参考:https://firebase.google.com/docs/analytics/unity/start?hl=ja

apkサイズ

ARMv7,ARM64,x86を選択したアプリで、28MBから32MBに増えた。

analyticsのeventカラム

https://firebase.google.com/docs/reference/unity/class/firebase/analytics/firebase-analytics?hl=ja#class_firebase_1_1_analytics_1_1_firebase_analytics_1a53ea47346994ec8c2c13ea8a4396e78e

サンプルイベント

スコア例

Firebase.Analytics.FirebaseAnalytics.LogEvent(
          Firebase.Analytics.FirebaseAnalytics.EventPostScore,
          new Firebase.Analytics.Parameter[] {
              new Firebase.Analytics.Parameter(
                Firebase.Analytics.FirebaseAnalytics.ParameterScore, 40),
              new Firebase.Analytics.Parameter(
                Firebase.Analytics.FirebaseAnalytics.ParameterCharacter, "tango"),
          }
);

課金例

Firebase.Analytics.FirebaseAnalytics.LogEvent(
          Firebase.Analytics.FirebaseAnalytics.EventAddPaymentInfo,
          new Firebase.Analytics.Parameter[] {
              new Firebase.Analytics.Parameter(
                Firebase.Analytics.FirebaseAnalytics.ParameterPaymentType, "Month"),
              new Firebase.Analytics.Parameter(
                Firebase.Analytics.FirebaseAnalytics.ParameterCharacter, "taro"),
          }
        );

カスタム項目

スネーク形式で書く。

Firebase.Analytics.FirebaseAnalytics.LogEvent(
            "hoge_column1",
            new Firebase.Analytics.Parameter[] {
              new Firebase.Analytics.Parameter(
                "hoge_column1-1", "taro"),
              new Firebase.Analytics.Parameter(
                "hoge_column1-2", "jiro"),
          }
        );

iosでanalyticsがカウントされない時

6.21.0 - <AppMeasurement>[I-ACS031025] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
6.21.0 - <AppMeasurement>[I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
6.21.0 - <AppMeasurement>[I-ACS025026] Deferring to Firebase for event data collection
6.21.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
6.21.0 - [Firebase/Analytics][I-ACS025028] AdMob and Firebase are in use in this app, but are not linked. For analytics data consistency and integrity, it is highly recommended that you link your AdMob app to the corresponding Firebase app and re-download the GoogleServices-Info.plist file. See https://support.google.com/admob/answer/6383165 for more information.
6.21.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled

No pending snapshot to activate. SDK name: app_measurementらへん見るとappstoreに公開前だから出てこないのかもしれない。