我必须使用Google Analytics(分析)保存事件,但仪表盘中始终有0个数据(自几天以来),而Firebase中有一些数据(用户数,操作系统,屏幕视图...)。 我知道Google Analytics(分析)很快将不可用,但该项目atm需要它。
我如何在应用程序类中初始化GA。
sAnalytics = GoogleAnalytics.getInstance(this);
@Synchronized
fun getDefaultTracker(): Tracker {
// To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
if (sTracker == null) {
sTracker = sAnalytics!!.newTracker(R.xml.global_tracker)
}
return sTracker!!
}
global_tracker文件包含良好的跟踪器ID。
在我的gradle文件中
classpath 'com.google.gms:google-services:4.2.0'
以及在应用gradle级别
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
我正在使用的唯一其他Firebase库是
implementation 'com.google.firebase:firebase-messaging:18.0.0'
和
implementation('com.ad4screen.sdk:plugin-firebase-messaging:2.5.0')
当我查看我的GA日志时,我有以下内容
06-28 10:36:46.602 I/GAv4 ( 6228): Google Analytics 12.4.51 is starting up. To enable debug logging on a device run:
06-28 10:36:46.602 I/GAv4 ( 6228): adb shell setprop log.tag.GAv4 DEBUG
06-28 10:36:46.602 I/GAv4 ( 6228): adb logcat -s GAv4
06-28 10:36:46.641 W/GAv4 ( 6228): CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See https://developers.google.com/analytics/devguides/collection/firebase/android/ for instructions.
06-28 10:39:54.712 D/GAv4 ( 6228): Hit delivery requested: ht=XXXXXXXX, _s=21, _v=ma12.4.51, a=XXXXXXXXXX, aid=my.package, an=AN, av=-adhoc, cd=WelcomePage, cid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, sr=1080x2088, t=screenview, tid="UA-XXXXXXXXX-1", ul=fr-fr, v=1
06-28 10:39:54.809 D/GAv4 ( 6228): Hit sent to the device AnalyticsService for delivery
06-28 10:39:54.809 D/GAv4 ( 6228): Dispatching local hits. Elapsed time since last dispatch (ms): 126422