Android - 已发送Google Analytics V4活动但未显示

时间:2016-09-19 09:40:48

标签: android google-analytics google-analytics-v4

我想在我的应用中集成Google Analytics SDK V4,但发送事件时遇到问题。 我集成了SDK并生成了the offical documentation上指示的配置文件。我在我的项目中集成了conf文件,设置了build.gradle文件,将AnalyticsService添加到我的Manifest并在我的应用程序类中初始化了Google Analytics:

synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        mTracker = analytics.newTracker(R.xml.global_tracker);
    }
    return mTracker;
}

R.xml.global_tracker是在构建时生成的,只包含字符串ga_trackingId。

当我尝试发送事件时,我可以在logcat上看到它们被发送:

09-19 11:04:29.167 com.myapp.mypackage.debug I/GAv4: Google Analytics 9.0.80 is starting up. To enable debug logging on a device run:
                                                          adb shell setprop log.tag.GAv4 DEBUG
                                                          adb logcat -s GAv4
09-19 11:04:29.207 com.myapp.mypackage.debug W/GAv4: AnalyticsReceiver is not registered or is disabled. Register the receiver for reliable dispatching on non-Google Play devices. See url for instructions.
09-19 11:04:29.227 com.myapp.mypackage.debug W/GAv4: CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See url for instructions.
09-19 11:04:29.737 com.myapp.mypackage.debug D/GAv4: Sending first hit to property: UA-XXXXXXXX-2
09-19 11:04:29.737 com.myapp.mypackage.debug D/GAv4: Hit delivery requested: ht=1474275869721, _s=0, _v=ma9.0.80, a=1185092937, aid=com.myapp.mypackage.debug, an=MyApp, av=1.7-DEBUG, cd=Search, cid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, sr=800x1280, t=screenview, tid=UA-XXXXXXXX-2, ul=fr-fr, v=1
09-19 11:04:30.148 com.myapp.mypackage.debug D/GAv4: Hit sent to the device AnalyticsService for delivery
09-19 11:05:49.235 com.myapp.mypackage.debug D/GAv4: Hit delivery requested: ht=1474275949229, _s=1, _v=ma9.0.80, a=1185092938, aid=com.myapp.mypackage.debug, an=MyApp, av=1.7-DEBUG, cd=Search, cid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, ea=CustomerAccount, ec=Search, sr=800x1280, t=event, tid=UA-XXXXXXXX-2, ul=fr-fr, v=1
09-19 11:05:49.425 com.myapp.mypackage.debug D/GAv4: Hit sent to the device AnalyticsService for delivery
09-19 11:05:49.435 com.myapp.mypackage.debug D/GAv4: Hit delivery requested: ht=1474275949372, _s=2, _v=ma9.0.80, a=1185092938, aid=com.myapp.mypackage.debug, an=MyApp, av=1.7-DEBUG, cd=UserAccount.LoggedOut, cid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, sr=800x1280, t=screenview, tid=UA-XXXXXXXX-2, ul=fr-fr, v=1
09-19 11:05:49.455 com.myapp.mypackage.debug D/GAv4: Hit sent to the device AnalyticsService for delivery

但我从未在开发者控制台上看到它们。当我在我的控制台上使用Analytics API时,我看到“此时间跨度内没有此API的数据”。我做了我的测试周五和超过48小时后的事件,他们没有出现。 另外,我在Analytics API控制台上看到了此警告:

  

此API已启用,但在您之前无法在项目中使用它   创建凭据。单击“转到凭据”以立即执行此操作   (强力推荐)。转到凭据概述配额

如果我转到凭证概述,我可以看到与我的google-services.json中的密钥对应的关键“Android密钥(由Google服务自动创建)”,所以我不明白为什么警告是这里。

你能看出问题的来源吗?我搜索了很多但是能够找到答案。

谢谢!

1 个答案:

答案 0 :(得分:0)

显然,我没有看好地方。我认为分析报告可以在开发控制台上看到,在Analytics API中,但是由于ZShock,我知道它们在analytics.google.com。它没有写在官方文档的任何地方,所以对新用户来说非常令人不安......