The project integrate GA and encountered some problems:
1. Too many hits sent Too quickly, rate limiting invoked
The problem is that sending hit (Event/screen) is too frequent to exceed Google's limits. The workaround is to set the session timeout to a suitable value, and the segment is sent uniformly to hit.
2. Google Play Services version compatibility issues
Because the Google Play Services version of the device is too old, you have to use an older version of Google Play services for compatibility.
' com.google.android.gms:play-services-base:6.5.87 '
This version comes with the GA package, but the package does not contain Analyticsreceiver and analyticsservice.
3. Statistical data loss after network disconnection
There has been a period of disconnection and then data loss after network recovery. Not only the data during the disconnection is not, and the data after the network recovery is no longer sent.
I changed some of the parameters of the Googleanalytics tracker, but I haven't started to test which of the settings have worked, and that's something to add.
Note the following is the Kotlin code
Analytics.setlocaldispatchperiod (Resources.getinteger (r.integer.ga_dispatchperiod))if(buildconfig.debug) {Analytics.logger.logLevel=Com.google.android.gms.analytics.Logger.LogLevel.VERBOSE//Analytics.setdryrun (True)} tracker=Analytics.newtracker (applicationContext.resources.getString (R.string.ga_trackingid)) Tracker.setsessiontimeout (60) tracker.enableexceptionreporting (true) tracker.enableadvertisingidcollection (true) tracker.enableautoactivitytracking (true)
It should be the role of localdispatchperiod, but it will not be known until after testing.
Of course this problem may be due to the Googleanalytics version issue. Google Play Services needs to be updated. Maybe if I use the latest version this problem won't appear, I haven't tested it yet.
Android Google Analytics