Praveen Reddy
Praveen Reddy

Reputation: 41

How to find average session duration in Firebase?

How to find the average duration of sessions or time spent on app in firebase?

Upvotes: 4

Views: 14002

Answers (3)

Steve Ganem
Steve Ganem

Reputation: 10851

The average session duration is shown on the dashboard in Firebase Analytics (see attachment).enter image description here

Upvotes: 2

Karun Shrestha
Karun Shrestha

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

Neh
Neh

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

Related Questions