简体   繁体   English

使用Google Play服务手动刷新Google Analytics(分析)事件

[英]Flush google analytics events manually with Google Play Services

Is there any way to manually flush all events in Google analytics queue, when Google Play Services is installed? 安装Google Play服务后,有什么方法可以手动刷新Google Analytics(分析)队列中的所有事件?

There is one method in the Android GA documentation: GoogleAnalytics.getInstance(getActivity().getBaseContext()).dispatchLocalHits(); Android GA文档中有一种方法: GoogleAnalytics.getInstance(getActivity().getBaseContext()).dispatchLocalHits();

But this method doesn't work with Google Play Services - the docs say : 但是此方法不适用于Google Play服务- 文档说

public void dispatchLocalHits ()

Dispatches queued hits (view, events, or transactions) to Google Analytics if a network connection is available, and the local dispatching service is in use. 如果网络连接可用且正在使用本地调度服务,则将排队命中的命中(视图,事件或事务)调度到Google Analytics(分析)。 This method only works if local dispatching is in use. 仅当使用本地调度时,此方法才有效。 Local dispatching is only used in the absence of Google Play services on the device. 仅当设备上没有Google Play服务时才使用本地调度。 In general, applications should not rely on the ability to dispatch hits manually. 通常,应用程序不应依赖于手动分发匹配的功能。

When Google Play service is available hits from the application are send over to the service without any delay (except for the processing time that should not take longer then milliseconds). 当Google Play服务可用时,应用程序中的匹配数据将立即发送到该服务中(处理时间应不超过毫秒)。 Once the data is send over to the service your application is not involved in the delivery. 数据发送到服务后,您的应用程序将不参与交付。 Your application process can safely be terminated and the hits will still be uploaded to the Analytics. 您的申请过程可以安全地终止,并且匹配数据仍将上传到Google Analytics(分析)。 The service itself will periodically dispatch the collected data from multiple application in compressed batches. 服务本身将定期分批从多个应用程序分派收集的数据。 Individual applications don't have control on the service dispatch schedule. 各个应用程序无法控制服务调度时间表。 In general the hits would be uploaded over the network within few minutes after they are reported by the application. 通常,匹配项将在应用程序报告匹配结果后的几分钟内通过网络上传。

Almost any device that has Google Play store installed will have Google Play services. 几乎所有安装了Google Play商店的设备都将提供Google Play服务。 Chances are your app is running on a Google Play device. 您的应用有可能在Google Play设备上运行。 Amazon Fire phone and many of the carrier sponsored devices in China will not have Google Play services. Amazon Fire电话和中国许多运营商赞助的设备将不会提供Google Play服务。

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

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