简体   繁体   English

Google Analytics iOS SDK,调度时间间隔非常长

[英]Google Analytics iOS SDK, very long dispatch interval

I've integrated Google Analytics iOS SDK in my iOS App, I want to set a long dispatch interval to avoid frequent network calls. 我在我的iOS应用中集成了Google Analytics iOS SDK,我想设置一个较长的调度间隔,以避免频繁的网络呼叫。 I want to set 6 hours or longer interval. 我想设置6小时或更长的间隔。

  // set Google Analytics dispatch interval, eg: 20 seconds
    [GAI sharedInstance].dispatchInterval = 6*60*60; // dispatch after every 6 hours 

I have few queries: 我几乎没有疑问:

Q1. Q1。 What will happen if App is killed just before the data is dispatched, will data be sent immediately when app is launched next time? 如果App在调度数据之前被杀死会发生什么,下次启动应用程序时会立即发送数据吗? (eg: app killed just few minutes before the dispatch interval). (例如:app在发送间隔前几分钟被杀死)。

Q2. Q2。 Let's suppose app tries to dispatch data after 6 hours but network is not available at that time. 我们假设应用程序尝试在6小时后发送数据,但当时网络不可用。 will data be dispatched again after next 6 hours as aggregate of 12 hours data? 数据将在接下来的6个小时后再次发送,作为12小时数据的汇总数据?

Any suggestion for optimised approach? 有关优化方法的任何建议吗? I don't want to consume network bandwidth after every few seconds or minutes just for minor data. 我不希望每隔几秒钟或几分钟就消耗网络带宽,仅用于次要数据。

dispatchInterval default is 120 (2 min). dispatchInterval默认为120(2分钟)。

Did you send a lot of datas? 你发了很多数据吗? If you have vital datas, I suggest to keep it as 120(or better). 如果您有重要的数据,我建议将其保持为120(或更好)。 As it use very minimal bandwidth. 因为它使用非常小的带宽。

If you are offline, the data will be sent when you are online again. 如果您处于离线状态,则再次联机时将发送数据。 (use event to test it easily in your app) (使用事件在您的应用中轻松测试)

According to Google.: Data collected using the Google Analytics SDK for iOS is stored locally before being dispatched on a separate thread to Google Analytics. 据Google称:使用Google Analytics SDK for iOS收集的数据在本地存储,然后再分发到Google Analytics的单独帖子中。

If a user loses network access or quits your app while there are still hits waiting to be dispatched, those hits are persisted in local storage. 如果用户在仍有等待发送的命中时丢失网络访问权限或退出应用程序,则这些匹配将保留在本地存储中。 They will be dispatched the next time your app is running and dispatch is called. 它们将在您的应用程序下次运行并调用调度时分派。

More info here: https://developers.google.com/analytics/devguides/collection/ios/v3/dispatch 有关详情,请访问: https//developers.google.com/analytics/devguides/collection/ios/v3/dispatch

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

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