Android - Google Analytics V4 事件已发送但未显示
Android - Google Analytics V4 event sent but not shown
我想在我的应用程序中集成 Google Analytics SDK V4,但我在发送事件时遇到问题。
我集成了 SDK 并生成了配置文件,如 the offical documentation 所示。我在我的项目中集成了 conf 文件,设置了我的 build.gradle 文件,将 AnalyticsService 添加到我的清单并在我的应用程序 class:
中初始化了 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 时,我看到 "There is no data for this API in this time span"。我在星期五进行了测试,并且在超过 48 小时后进行了测试,但它们没有出现。
此外,我在 Analytics API 控制台上看到此警告:
This API is enabled, but you can't use it in your project until you
create credentials. Click "Go to Credentials" to do this now
(strongly recommended). Go to Credentials Overview Quotas
如果我去 Credentials Overview,我可以看到密钥 "Android key (auto created by Google Service)" 对应于我 google-services.json 中的密钥,所以我不明白为什么警告在这里。
你能看出问题出在哪里吗?我搜索了很多,但能够找到对它的回应。
谢谢!
很显然,我没有看好地方。我认为分析报告可以在开发控制台的 Analytics API 中看到,但感谢 ZShock,我知道它们在 analytics.google.com 上。它没有写在官方文档的任何地方,所以这对新用户来说非常令人不安......
我想在我的应用程序中集成 Google Analytics SDK V4,但我在发送事件时遇到问题。 我集成了 SDK 并生成了配置文件,如 the offical documentation 所示。我在我的项目中集成了 conf 文件,设置了我的 build.gradle 文件,将 AnalyticsService 添加到我的清单并在我的应用程序 class:
中初始化了 Google Analyticssynchronized 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 时,我看到 "There is no data for this API in this time span"。我在星期五进行了测试,并且在超过 48 小时后进行了测试,但它们没有出现。 此外,我在 Analytics API 控制台上看到此警告:
This API is enabled, but you can't use it in your project until you create credentials. Click "Go to Credentials" to do this now (strongly recommended). Go to Credentials Overview Quotas
如果我去 Credentials Overview,我可以看到密钥 "Android key (auto created by Google Service)" 对应于我 google-services.json 中的密钥,所以我不明白为什么警告在这里。
你能看出问题出在哪里吗?我搜索了很多,但能够找到对它的回应。
谢谢!
很显然,我没有看好地方。我认为分析报告可以在开发控制台的 Analytics API 中看到,但感谢 ZShock,我知道它们在 analytics.google.com 上。它没有写在官方文档的任何地方,所以这对新用户来说非常令人不安......