简体   繁体   English

未在 Google Analytics(Android 应用)中发送的事件

[英]Events not being sent in Google Analytics (Android app)

I'm watching DebugView on the Google Analytics pages and all my ScreenViews are showing up just fine.我正在 Google Analytics 页面上观看 DebugView,我所有的 ScreenView 都显示得很好。

But my app is also sending events and they just don't show up at all.但是我的应用程序也在发送事件,而它们根本不显示。

I'm sending ScreenViews with (pseudocode):我正在发送带有(伪代码)的屏幕视图:

sTracker = sAnalytics.newTracker(R.xml.global_tracker);
sTracker.send(new HitBuilders.ScreenViewBuilder().build());

And I'm sending events with:我正在发送事件:

sTracker = sAnalytics.newTracker(R.xml.global_tracker);
sTracker.send(new HitBuilders.EventBuilder()
        .setCategory("event")
        .setAction(eventName)
        .build());

I've used:我用过:

adb shell setprop debug.firebase.analytics.app <package_name>

to enable the analytics output in logcat.在 logcat 中启用分析输出。 When I send a screenview there's loads of activity and the screenview appears in the online DebugView.当我发送屏幕视图时,有大量活动,并且屏幕视图出现在在线 DebugView 中。

But when I send an event there's no activity at all.但是当我发送一个事件时,根本没有任何活动。

Am I missing some secret config somewhere?我是不是在某处遗漏了一些秘密配置?

Thanks谢谢

=============== ================

Partial answer: I used adb shell setprop log.tag.GAv4 DEBUG to increase the logging to logcat and it said: Discarding hit.部分答案:我使用 adb shell setprop log.tag.GAv4 DEBUG 将日志记录增加到 logcat,它说:丢弃命中。 Missing tracking id parameter: cd=org.whatever,a=,t=event,...,ea=,ec=event缺少跟踪 ID 参数:cd=org.whatever,a=,t=event,...,ea=,ec=event

So instead of contructing the Tracker with the XML, I'm constructed it with a string (a Tracker ID value).因此,我没有用 XML 构造跟踪器,而是用字符串(跟踪器 ID 值)构造它。 So now it sends the event but it still doesn't arrive at the DebugView, probably because I'm not using the correct Tracking ID.所以现在它发送了事件,但它仍然没有到达 DebugView,可能是因为我没有使用正确的跟踪 ID。

Can anyone shed any light on where I can find this Tracker ID?谁能告诉我在哪里可以找到此跟踪器 ID? The documentation seems out of date - it's not where it says it should be.文档似乎已经过时 - 它不是它所说的应该在的地方。 I can't find a Tracker ID anywhere.我在任何地方都找不到跟踪器 ID。

Thanks.谢谢。

Well, the only way I found to get the Tracker ID was to delete the account - Google then emails you, including the UA-xxxxxx number and you can go and undelete the account;好吧,我发现获取跟踪器 ID 的唯一方法是删除该帐户 - Google 然后通过电子邮件向您发送电子邮件,包括 UA-xxxxxx 号码,您可以去取消删除该帐户; by adding the property/data stream ID on the end of the UA-xxxx number you can re-construct the Tracking ID (form UA-xxxxx-x).通过在 UA-xxxx 编号的末尾添加属性/数据流 ID,您可以重新构建跟踪 ID(格式 UA-xxxxx-x)。 You can also delete the Property (or Data Stream, I'm not sure now) and they sometimes email you the actual full Tracking ID.您还可以删除属性(或数据流,我现在不确定),他们有时会通过电子邮件向您发送实际的完整跟踪 ID。

But even with the Tracking ID I couldn't get the events to show up on the server.但即使使用跟踪 ID,我也无法让事件显示在服务器上。 The only way I got it working was to ignore all the documentation as send the events as follows instead:我让它工作的唯一方法是忽略所有文档,而是按如下方式发送事件:

sFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
// Add Parameters like this:
Bundle params = new Bundle();
params.putString("param_name", "param_val");
sFirebaseAnalytics.logEvent(eventName, params);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM