Reputation: 41
How to find the average duration of sessions or time spent on app in firebase?
Upvotes: 4
Views: 14002
Reputation: 10851
The average session duration is shown on the dashboard in Firebase Analytics (see attachment).
Upvotes: 2
Reputation: 733
What you can do is, start counting after the app is opened and stop the counting after the app is closed.
Let us suppose
timeSpent = 20 seconds
Now get the previous time spent from the firebase database then calculate the average from the two, then save the result in the same firebase child.
avgTimeSpent = (last time's time spent + timeSpent)/2
Now save avgTimeSpent in firebase, and next time when calculating the average use the now saved avgTimeSpent. Hope this helps.
Upvotes: 0
Reputation: 452
Automatically collected events are triggered by basic interactions with your app. As long as you use the Firebase SDK, you don’t need to write any additional code to collect these events.
Below are list of event collected automatically. These events may be helpful in this case when you wish to find the time spent/duration of sessions : first_open, user_engagement, session_start etc.
You can have a complete reference at http://www.androidhive.info/2016/06/android-firebase-integrate-analytics/
Hope this helps.
Upvotes: 0