Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I want to set 6 hours or longer interval.

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

I have few queries:

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? (eg: app killed just few minutes before the dispatch interval).

Q2. Let's suppose app tries to dispatch data after 6 hours but network is not available at that time. will data be dispatched again after next 6 hours as aggregate of 12 hours data?

Any suggestion for optimised approach? I don't want to consume network bandwidth after every few seconds or minutes just for minor data.

like image 447
W.S Avatar asked Nov 15 '13 22:11

W.S


1 Answers

dispatchInterval default is 120 (2 min).

Did you send a lot of datas? If you have vital datas, I suggest to keep it as 120(or better). 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.

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

like image 162
Franck Avatar answered Nov 14 '22 22:11

Franck