countly-sdk-react-native icon indicating copy to clipboard operation
countly-sdk-react-native copied to clipboard

Backgrounding app artificially inflates session duration by value of SESSION_DURATION

Open garyhogarth opened this issue 7 years ago • 4 comments

The way that the app state change is handled, it fires a session_stop event when backgrounding the app, if you bring the app to the foreground it sends a subsequent session_start event.

If you do this during the time defined in SESSION_DURATION (default: 60 seconds), it seems like the count.ly servers consider this the same session (this is good). However when viewing the dashboard I observer the session_stop event has increased the "duration" of the session by 60 seconds.

I guess you can see where I am going here, and this may be only an issue with the UI of count.ly rather than this SDK. If I sit there and constantly background and foreground the app my session duration goes through the roof.

Example: I took this screenshot at 15:38 however the session started at 15:37 is already 17 minutes long.

image

garyhogarth avatar Oct 18 '18 15:10 garyhogarth

Hi Gorkem,

Can you add Artem in this thread? As this issue is partially related to the SDK. and partially with server background.

@gorkem-cetin

Thanks

trinisofttechnologies avatar Feb 19 '19 12:02 trinisofttechnologies

Sure.. @iartem what do you think?

gorkem-cetin avatar Feb 19 '19 21:02 gorkem-cetin

@trinisofttechnologies it's not related to the server whatsoever. React SDK doesn't even calculate the time spent in the foreground, it just always sends session interval as duration (default value is 60 seconds). Even on end_session irrespective the moment it is called. https://github.com/Countly/countly-sdk-react-native/blob/master/Countly.js#L395

iartem avatar Feb 20 '19 11:02 iartem

Ok will continue to review on this.

trinisofttechnologies avatar Feb 21 '19 06:02 trinisofttechnologies