Skip to content

Commit

Permalink
cros: Add WindowFocused user action to the applist.
Browse files Browse the repository at this point in the history
PM and outside teams want to be able to understand launcher usage. One
key metric is the 'click through rate' (CTR) of the launcher. To
accurately calculate this, we need to know how many times the launcher
is shown to the user.

The most dependable way to measure this is to record when the applist
window gains focus.

Bug: 962725
Change-Id: If06fb022c2bf43cd3af9901353bf3bdcc438d197
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635361
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Reviewed-by: Kevin Strohbehn <ginko@google.com>
Auto-Submit: Alex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667821}
  • Loading branch information
Alex Newcomer authored and Commit Bot committed Jun 11, 2019
1 parent 3a14bbe commit 61e72df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
6 changes: 5 additions & 1 deletion ash/app_list/presenter/app_list_presenter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,20 @@ void AppListPresenterImpl::OnWindowFocused(aura::Window* gained_focus,
aura::Window* lost_focus) {
if (view_ && is_target_visibility_show_) {
aura::Window* applist_window = view_->GetWidget()->GetNativeView();
const bool applist_gained_focus = applist_window->Contains(gained_focus);
if (delegate_->IsTabletMode()) {
if (applist_window->Contains(lost_focus)) {
home_launcher_shown_ = false;
HandleCloseOpenSearchBox();
} else if (applist_window->Contains(gained_focus)) {
} else if (applist_gained_focus) {
home_launcher_shown_ = true;
view_->OnHomeLauncherGainingFocusWithoutAnimation();
}
}

if (applist_gained_focus)
base::RecordAction(base::UserMetricsAction("AppList_WindowFocused"));

aura::Window* applist_container = applist_window->parent();
if (applist_container->Contains(lost_focus) &&
(!gained_focus || !applist_container->Contains(gained_focus)) &&
Expand Down
11 changes: 11 additions & 0 deletions tools/metrics/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2270,6 +2270,17 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description>
</action>

<action name="AppList_WindowFocused">
<owner>newcomer@chromium.org</owner>
<description>
Emitted when the AppList has gained focus. The AppList gains focus every
time it is shown to the user, so this is equivalent to being emitted when
the AppList is shown to the user. This can be used in combination with
launch/activation metrics to calculate the click through rate in the
AppList.
</description>
</action>

<action name="AppList_ZeroStateOpenInstalledApp">
<owner>jennyz@chromium.org</owner>
<owner>newcomer@chromium.org</owner>
Expand Down
8 changes: 6 additions & 2 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4478,11 +4478,15 @@ uploading your change for review.
</summary>
</histogram>

<histogram name="Apps.AppListShowSource" enum="AppListShowSource">
<histogram name="Apps.AppListShowSource" enum="AppListShowSource"
expires_after="2020-01-01">
<owner>newcomer@chromium.org</owner>
<summary>
The number of times the different sources for showing the app list are used.
This is logged when the app list is shown.
This is logged when the app list is shown. Does not count the app list shown
when the last window is closed in tablet mode. This is not the total number
of times the app list is shown to the user; for that consult the user action
AppList_WindowFocused.
</summary>
</histogram>

Expand Down

0 comments on commit 61e72df

Please sign in to comment.