This article explains session time estimation for events received from your event data. Session times are usually helpful in tracking usage trends over time. You can use this in setting up alerts to notify you when a user of your product has not logged in or spent enough time on your product. This can also be added as a component of your Healthscore calculation within Natero. Hence it might be worth knowing how session times are calculated or estimated. For NateroJS and events where Session ID exists, we use session ID to identify the current session of a user. In cases where session ID is not present we estimate the session time. Our estimates for time spent are fairly conservative as we heavily discount perceived idle time.
Visit support article Session ID and Session Time to learn about user time spent for Natero JS(no estimation performed).
How Natero Estimates Session Time?
For events(segment, mixpanel, REST API, Pendo) that does not track the time a user spends on the product, Natero attempts to estimate the time spent within a module and time spent within a session. In Segment, the anonymousId field denotes the session ID and it is used to track individual user sessions. If there is no anonymousId present, Natero can generate a unique session ID. In the latter case, the session ID times out after a period of 30 minutes of inactivity; after that period a new session ID will be generated.
Fields Required for Session Calculation
- anonymousId or generated session Id
- event timestamp (typically receivedAt)
- accountId (typically groupId)
In addition to the session Id field (anonymousId) and the timestamp, the userId and accountId are also necessary. The userId field refers to the user in question and the accountId/groupId refers to the account. If different anonymousIds are provided for the same timestamp, userId and accountID they are considered as two different session streams.
There are 2 session metrics that are generated from session data:
1. Number of sessions: Within each event sent to us, we look for session Id and the timestamp. If an anonymousId is provided, then we count the number of unique anonymousIds we see as the number of sessions. If there is no anonymousId and Natero is generating a session Id, then that session is timed out after 30 minutes after the user goes idle. Again, we count the number of unique session Ids a user of an account has had.
2. Time spent within a session: We estimate the total time spent in the session by looking at the time between events that contain the same session Id. If more than 5 minutes have passed between events, we ignore that time period as we deduce the user as being idle. We then sum up the difference between events, where that difference is not greater than 5 minutes. For example: imagine you have 3 events spread out from each other: event1 @ 12:00pm and event 2 @ 12:08pm and event 3 @ 12:12pm with the same session Id, userId and accountID. The total estimated session time would be 4 minutes. The difference between event1 and event2 is greater than 5 minutes, so it is not counted. The difference between the 2nd and the 3rd event is 4 minutes, thus it is added to the total time.