GoogleAnalyticsTracker Store full - android

I've seen a couple of similar posts on this site, but neither one had any response so I'm going to post my issue.
I'm getting the following warnings from GoogleAnalyticsTracker: Store full. Not storing last event.
I'm using GoogleAnalyticsTracker in my Android app to store analytics. It all executes fine, except for the above warnings, however no data seems to be getting to Google Analytics since every time I check it there's nothing there.
GoogleAnalyticsTracker tracker;
tracker = GoogleAnalyticsTracker.getInstance();
tracker.startNewSession(GA_ID , this);
// i've got a bunch of these throughout my activity
tracker.trackEvent("BTN CLICK", "myactivity", "some info",n);
Can anyone from Google provide some info on this?

you need to manually call dispatch to push stored events or better star with autamatic dispatch with giving an interval.
Change it to this, and your events will pushed to analytics every 10 seconds.
tracker.startNewSession(GA_ID , 10, this);

It's because you didn't set the dispatch interval in startNewSession method. You can either set it in above method or do it manually by tracker.dispatch() method.

Related

I/Counters: exceeded sample count in FrameTime log

I recently started to see this logs I/Counters: exceeded sample count in FrameTime multiple times in my app logcat, I understood it comes from Google Maps.
Any idea what it means? and how to get rid of it?
Try disabling a few layers of the widget (like say 'myLocation' layer enabled by using 'myLocationEnabled' parameter) and enable them back in the release build. Also make sure you are disposing your Google Maps Controller in the dispose method (if you are storing it somewhere after taking it from onMapCreated).
As far as I can figure out from the error and the API docs, GoogleMaps has multiple layers and each layer needs to be built in a given FrameTime. Since the added burden of multiple layers slow down the processing, it may exceed given FrameTime and trigger the error.
The reason may also include the fact that debug builds have no optimisations and that really affects the GoogleMaps package. I tried the same app with the constant barrage of 'I/Counters: exceeded sample count in FrameTime' errors in release build on a real device and the errors seem to not appear, implying these errors can simply be ignored.
While we wait for a fix you can set these to fold (in Android Studio) by going to File->Setting->Editor->General->Console and adding "exceeded sample count in FrameTime" to the list "Fold console lines that contain:"
I had the same issue since this morning, it was gone when after I:
stopped my emulator
wiped the data
cold booted it.
NOTE: this is with android
For Android emulators it's enough to wipe the data of the device and the FrameTime messages will go away.
EDIT: Sadly, this isn't a permanent solution as messages will start appearing after re-opning the emulator. I will be back with another update if I stumble upon a permanent fix.
I had a similar issue, for me I had setup a location listener:
location.onLocationChanged.listen(l) {
controller.animateCamera(...);
}
This appeared to be called even though the phone location had not changed, so I added a check to store the previous known location and in the listen, I compared the streamData with my location and only performed the update if there was a change.
Perhaps you can post your code to see if this could be the reason?
It's happening inside onLocationChanged method.
When I set isMyLocationEnabled to false at some extent it was removed but fully, now there were lesser log statement.
It happens when the map moves (or probably more specifically when it is redrawn). Both when animating, and also when manually sliding it around. My logcat is spammed full of Counters: exceeded sample count in FrameTime messages. This explains why you'll see less when not having my location enabled: The map doesn't move as much...
It's so annoying.
For flutter: I was using setState() method with a google map and there was also a locationListener(). So I removed the setState() and instead I did update my screen using provider. And the warnings were gone.

Google analytics doesn't send event before setAppOptOut(true)

I try to send an event just before disabling the Google analytics in android. But, the event doesn't show up in the real-time GA console.
tracker.send(new HitBuilders.EventBuilder()
.setCategory(category)
.setAction(action)
.setLabel(label)
.build());
//disable GA
GoogleAnalytics.getInstance(this).setAppOptOut(true);
Thanks for any advice.
If you enable Google Analytics logging you can see that when you call setAppOptOut(true) Google Analytics will clear all queued hits since it last sent hits to the Google Analytics servers:
V/GAV4﹕ Thread[GAThread,5,main]: clearHits called
As you noticed yourself dispatchLocalHits() doesn't help since it does nothing with Google Play Services installed. What you need to do is to wait with calling setAppOptOut(true) until after your hits have been dispatched. However as you don't know when the hits are dispatched it's not an easy thing to do.
You can specify what dispatch period your app should have with the ga_dispatchPeriod setting (with the default being 30 minutes). If you wait for longer than the configured dispatch period you should be fairly certain that your event has been sent, however this is not guaranteed since GA may wait with sending the data even longer if you do not have any network connection at the moment.
If you would take this approach you must make sure that the wait works across sessions since Google Play services is a separate service on the device and it will hold on to your hits even if you restart your app. So opting out on next startup of your app will not work either.
However waiting with opting out for more than 30 minutes might not be very nice to your users since that gives a lot of time for data to be gathered and submitted after the user thinks that they have opted out.
A better approach might be to have your own internal Google Analytics wrapper class that all parts of your app calls to report data. Then each reporting method could have a check if Google Analytics is enabled, never call any of the real Google Analytics methods.
This way you can be sure that you final event is sent to Google Analytics while no more events are sent after that even though you don't call setAppOptOut(true).
Do note that this only works if you do not rely on any automatic tracking like automatic reporting of uncaught exceptions or automatic screen measurement.

Google analytics Fragment screen views

My app has one activity and many fragments. I've read about ALL topics about this question, and no one worked as I can see.
I've tried with both ga v3 and v4, following the
The problem is that BOTH ways, analytics retrieve only the first call I perform. When I change fragment, and perform another call in the same way, the 'real-time' analytics doesn't change.
Both snippets are executed from onStart() method in every fragment.
// Using ga v4
Tracker t = GoogleAnalytics.getInstance(this).getTracker("UA-XXXX-1");
t.setScreenName("/home");
t.send(new HitBuilders.AppViewBuilder().build());
// Using ga v3
EasyTracker _tracker = EasyTracker.getInstance(getActivity());
_tracker.set(Fields.SCREEN_NAME, "/discover");
_tracker.send(MapBuilder.createAppView().build());
Any suggestion would be highly appreciated!
Actually I think I might found the way to make it works. Reading the documentation: https://developers.google.com/analytics/devguides/collection/android/v4/dispatch
By default, data is dispatched from the Google Analytics SDK for
Android every 30 minutes.
Yes, my thoughts were "What???? 30 minutes? Is not suppose to be real time?" Anyway, reading a bit more:
To set the dispatch period programmatically:
// Set the dispatch period in seconds.
GoogleAnalytics.getInstance(this).setLocalDispatchPeriod(15);
To set the dispatch period in the XML configuration file:
<integer name="ga_dispatchPeriod">30</integer>
What more...
Setting a negative value will disable periodic dispatch, requiring that you use manual dispatch if you want to send any data to Google Analytics.
// Disable periodic dispatch by setting dispatch period to a value less than 1.
GoogleAnalytics.getInstance(this).setLocalDispatchPeriod(0);
Ok, maybe you have found a controversial here, negative value or less than 1? I tried, it is less than 1! (0 or negative number will disable periodic dispatch).
If you prefer then the manual dispatch, that would be, for example:
tracker.setScreenName(TAG);
tracker.send(new HitBuilders.AppViewBuilder().build());
GoogleAnalytics.getInstance(getActivity().getBaseContext()).dispatchLocalHits();
Notice that you can call dispatchLocalHits() whenever you want (even make a button that calls that function). By the way, that piece of code it's on my fragments (in the onResume() method).
Also the documentation says:
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.
But I was not sure if this applies to both manual and periodic dispatch. I tried it, both seem to be working :)

Google Analytics - List event values per event label

My current situation:
I might have the complete wrong approach on this, so please tell me if I should do this differently.
I send an event from my Android app to track DB load times.
Event Category: 'DB'
Event Label: 'DBLoadTime'
Event Value: 2356 (Or however long the DB took to load in
milliseconds)
In Analytics I would like to get a table view of all the different load times, listed under each other. From the analytics documentation I could see that they seem to accumulate all the event values as they are received. This means I can only get the total value, or an average value. however, they also use a similar example to what I have, where they use the event value to store 'doanload time' for a video.
My question
Is this at all possible, or are values from similar event labels accumulated by default, and there is no way to get them listed as separate values.
If it is not possible, how can I get this info? Maybe by sending the load time as an event label?
Why I need to know:
Highest value does not really serve me any purpose, as there might be one guy with one really slow device experiencing long load times, where the 2nd longest load time is already half of that.
Average value does not tell me much either, as there are many people trying the app out, with just one or two records in the DB, which will always load fast.
It seems like what you want is a histogram to see the distribution of event values for that eventLabel and eventCategory. We've wanted to see the same sort of thing -- because seeing the actual distribution (or even quartiles) is much more helpful than just seeing a mean and a sum.
Unfortunately (d'oh!) GA currently does not support reporting histograms for eventValue. I've spoken with several of the GA developers about this and no one has said that this is going to happen sometime soon (d'oh!).
Thankfully, we've found a workaround that the GA developers have said is ok -- i.e. not in violation of a terms of service.
Instead of reporting the number of milliseconds that the device took to load, you can include this number as a string in EITHER a custom-dimension, or--in this case-- as the string in eventAction. This will allow you to report how many hits there were of each ms number.
If you are using the GA reporting API -- or the very helpful explorer -- then you can re-bin as you like, from which you can generate histograms to see the distribution.

Android Google Analytics v2 manually manage session without using EasyTracker

I need to start and to stop a session at a specific hour.
In official documentation I have found only that I can start a new session :
// Called after a user successfully signs in to your app.
private void onSignIn() {
... // The rest of your onSignIn() code.
myTracker.setStartSession(true); // Where myTracker is an instance of Tracker.
myTracker.sendEvent("app_flow", "sign_in", "", null); // First activity of new session.
}
But I have no methods in API to stop the session or to change the session time out.
I already tried to set ga_sessionTimeout to 1 day but it didn't worked,after ~8 minutes the session was closed even when the activity was still on the screen.I saw it on my Google Analytics dashboard's real-time overview.
Other ideas will be appreciated.
By default, Google Analytics will group hits that are received within
30 minutes of one another into the same session.
My goal was to keep the session alive till some event happen,
therefore I decided to implement Heartbeat mechanism.
That will send event every X minutes to keep the session alive.
It solved my problem.
P.S. : I discovered another thread with same solution.

Categories

Resources