Page MenuHomePhabricator

Decide on a system for measuring session length
Closed, ResolvedPublic

Description

Calculating any session length statistic requires us to be able to determine how long sessions are (as well as deciding what counts as a session).

Defining a session is one question, but another question is figuring out how to technically measure it. Below are several vastly different approaches, differing in complexity, privacy, and feasibility:

Heartbeat approach (mentioned here and currently used here)

Client pings the server (sending an event) at a regular interval, the last ping is approximately when the session ended.

"On unload" approach:

Client keeps track of how long the session has lasted and sends a time duration as an event on page unload / app close.

"On load/unload" approach:

Client sends event containing an identifier and a "start" timestamp at the start of the session. Then another event with the same identifier and a "stop" timestamp on unload/close, offloading timestamp differencing calculation to some server-side ETL process.

Implicit approach:

With enough features/experiences having analytics instrumentation attached and an identifier linking them all to the same session (the behavior of the Modern Event Platform Client Libraries), we do not need instrumentation solely for session lengths and can simply have an ETL process that joins multiple tables together by session ID, finds the first event sent in a session, finds the last event sent in a session, and differences their timestamps.

Event Timeline

LGoto triaged this task as Medium priority.
LGoto moved this task from Triage to Needs Investigation on the Product-Analytics board.

@jlinehan, @SNowick_WMF, and I met with the mobile apps PMs to define sessions on iOS & Android. We settled on:

a session ends when the app has closed completely or after 15 minutes of inactivity (being in the background)

Next we need to figure out the same for the web.

mpopov reassigned this task from mpopov to jlinehan.

Yeah I guess this is resolved since a decision was made at some point to use heartbeat approach and is being tracked in T248987