New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 615080 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Feature



Sign in to add a comment

Create session tracking metrics for Chrome Desktop

Project Member Reported by dah...@chromium.org, May 26 2016

Issue description

We would like to be able to track number of sessions, session length and total time used per day on Chrome Desktop. Since there is no definitive way to measure a user session, we propose the following definition.

A session as the contiguous time period in which the user has done any of the following:
-entered/exited full screen,
-completed a mouse/keyboard input event in Chrome,
-played (or is playing) an audio or video file in Chrome,
-made the Chrome Window active (foreground),
-not had the screen saver come on,

with no more than an [N] minute gap. Ideally, [N] should be defined using some existing data, but in absence of that, we should use 5 min as the default. 


 
[This is probably what you already intend:]
I suggest that the length of a session be recorded (upon the send of the session) in a histogram, named something like "Session.TotalDuration.Desktop" so it's easy to find for people who are used to looking for Session.TotalDuration (which is for mobile).  I don't think it's appropriate to reuse the same histogram because the logic is so different.  Emitting a single entry upon the end of a session will provide information needed to calculate all the information you want: number of sessions, session length, and total time used per day.

According to those definitions above, the end of session is either:
- when the screensaver turns on*
or
at time [N] minutes after the last time:
- all audio and video playing played
- a mouse or keyword input event happened in Chrome
- Chrome has been brought to the foreground

*(Is this a good definition?  If I'm playing music through Chrome and the screensaver comes on, will it keep playing?)

>>>
Ideally, [N] should be defined using some existing data, but in absence of that, we should use 5 min as the default. 
>>>

I might be able to do some analysis of user actions in UMA logs to help determine how the choice of [N] affects things.  However, I'm not sure how much it'll help.  Better yet, there might published research in the UI / HCI (human-computer interaction) about idle time and engagement.  That might be a better way to choose.

In all though, I think the proposed value of 5 is a reasonable starting point.  If we see data that indicates this is a poor choice (for instance many users with many sessions; few users with only one or two), that might indicate the value is too short and we're ending sessions when they shouldn't be.

Long story short: I can help you pre-choose a value of [N] if you think it's worthwhile to do.  I believe we'd end up picking a value in the 5 minutes to 15 minutes range.  (15 minutes is the default time for screensavers to kick in on most operating systems.)  I'm skeptical that the particular value within this range is important.
Components: Internals>Metrics
Cc: asvitk...@chromium.org rkaplow@chromium.org
Adding interested UMA folks to this bug, who have been discussing building a similar system.

Comment 5 by dah...@chromium.org, May 27 2016

A histogram at the end of the session with the session length makes sense. To calculate the total number of sessions, we would just do a count on the number of Session.TotalDuration.Desktop events, correct? I agree that we should treat this separate than mobile due to the semantic differences. We also need to add that a session would terminate if Chrome is closed or if the device is locked or goes to sleep. Audio does continue while a device is locked or has a screensaver on, so I think the matrix looks like this:

The end of the session is either:
-When Chrome is closed (in this case, can we send before we close or on the next startup?)
-Device goes to sleep
-Device goes into hibernate
-Device is powered off
-When screensaver turns on AND media is not playing
-When device is locked AND media is not playing

or at time [N] minutes after the last time:
-all audio and video played
-a mouse of keyboard event happened in Chrome
-Chrome has been brought to the foreground

I wonder if there is a separate signal that we can capture to help us understand whether we have correctly set [N]. For example, perhaps on the next event after a session has been closed (input, app to foreground, etc.) we send a histogram Session.TimeSinceLastSessionClosed. If we see a bunch of small events (30 seconds, 1 min, etc.) then we know we have it set to short. Maybe that is too complicated, but it would provide a more direct signal. Right now, we are likely to see a huge number of 5 min sessions, which could overstate real usage.

I like the idea of published research. Let me do some digging on UI/HCI and see if there is anything we can pull before you run off and do more data analysis. 


For what it's worth, I like the idea of Session.TimeSinceLastSessionClosed.
Please make sure we take into account whether a window is minimized/iconified to the system tray or Dock when determining its visibility. If a minimized window is streaming audio it's still considered 'active' but shouldn't be considered 'visible'.

Comment 8 by gayane@chromium.org, Jun 27 2016

Cc: gayane@chromium.org
Labels: -OS-Chrome
Project Member

Comment 10 by bugdroid1@chromium.org, Aug 3 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c4053604844bed762906984ac304f82e2db787d5

commit c4053604844bed762906984ac304f82e2db787d5
Author: gayane <gayane@chromium.org>
Date: Wed Aug 03 20:10:09 2016

Add desktop engagement metrics.

Add desktop engagement metrics which records Chrome session length.
This metrics takes into account Chrome visibility, presence of audio and
user interaction to start and end sessions.

Parts of this CL are derived from the following CLs:
https://codereview.chromium.org/2127143002/ by chrisha@
https://codereview.chromium.org/2101743002/ by asvitkine@
https://codereview.chromium.org/2102263002/ by pmonette@

BUG= 615080 

Review-Url: https://codereview.chromium.org/2142983002
Cr-Commit-Position: refs/heads/master@{#409603}

[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/android/metrics/uma_session_stats.cc
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/chrome_browser_main.cc
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/audible_contents_tracker.cc
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/audible_contents_tracker.h
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/audible_contents_tracker_browsertest.cc
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/chrome_visibility_observer.cc
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/chrome_visibility_observer.h
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/chrome_visibility_observer_browsertest.cc
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/desktop_engagement_observer.cc
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/desktop_engagement_observer.h
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/desktop_engagement_service.cc
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/desktop_engagement_service.h
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/metrics/desktop_engagement/desktop_engagement_service_unittest.cc
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/ui/browser_list.cc
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/ui/browser_list.h
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/ui/browser_list_observer.h
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/ui/cocoa/browser_window_controller.mm
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/ui/tab_helpers.cc
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/ui/views/frame/browser_frame.cc
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/browser/ui/views/frame/browser_view.cc
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/chrome_browser.gypi
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/chrome_tests.gypi
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/chrome_tests_unit.gypi
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/test/BUILD.gn
[add] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/chrome/test/data/autoplay_audio.html
[modify] https://crrev.com/c4053604844bed762906984ac304f82e2db787d5/tools/metrics/histograms/histograms.xml

Cc: chrisha@chromium.org
Owner: gayane@chromium.org
Status: Fixed (was: Assigned)

Sign in to add a comment