Ionic Analytics data takes up most of localStorage space

I’m developing a mobile App using Ionic Framework. I tried to get the Ionic Analytics running by doing everything from scratch.

According to this :

To cut down on battery drain when sending events, Ionic Analytics does not send an HTTP request for every event tracked. Instead, it queues events in memory and sends a batch of events every 30 seconds. This 30 seconds is the dispatch interval.

So i assume every 30 seconds my analytics data should sync. For development i’m using Ionic serve --lab to debug my app and i’m tracking my localStorage usage with HTML5 Storage Manager All In One extension.

As i’m working with my app and tapping around and going to different states, Ionic is capturing my movements and in the log i see Ionic Analytics: enqueuing event to send later: Tap Object{...} and as i’m tracking my localStorage, the available space gets smaller and smaller. As this go on for quite some time, eventually i’ll hit the size quota limit and i’ll receive error until i manually delete my localStorage.

My question would be why the 30 second interval doesn’t free up the space used by Ionic Analytics queued events? Is this behavior normal when i’m testing on browser and will it be okay on actual mobile devices?

I found out what the problem was and I’m afraid it was my own error. I’m posting what i did wrong so maybe someone doesn’t make the same mistake.

Normally for Ionic Analytics you have something like this in your app.js file :$ionicPlatform, $ionicAnalytics) {
  $ionicPlatform.ready(function() {

  // Some code here that throw errors when you are on browser rather than real device    



So basically i had some code before the $ionicAnalytics.register(); that only worked when i was testing with the real device and threw errors when i was in browser, so those uncaught errors were not allowing the $ionicAnalytics.register(); to run which is essential for sending the queued events. So my event queue would only increase because it never sent the data to the server. I learned my lesson here, either comment out the stuff you write for real devices or pay attention to those errors thrown in console and resolve them.

1 Like

To know about Ionic Analytics data takes up most of the localStorage space is a question which I also faced the same issue on the browser but confuse it be okay on actual mobile devices?. I have knowledge of data analytics and work as an intern in So I have interested to know more about the data analytics topic.