1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260

ash / public / cpp / app_list / app_list_metrics.h [blame]

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_PUBLIC_CPP_APP_LIST_APP_LIST_METRICS_H_
#define ASH_PUBLIC_CPP_APP_LIST_APP_LIST_METRICS_H_

#include "ash/public/cpp/ash_public_export.h"

#include <string>

namespace ash {
enum class AppListLaunchedFrom;
enum class AppListOrderUpdateEvent;
enum class AppListSortOrder;

// UMA histograms that record the actions that clear the pref sort order.
ASH_PUBLIC_EXPORT extern const char kClamshellPrefOrderClearActionHistogram[];
ASH_PUBLIC_EXPORT extern const char kTabletPrefOrderClearActionHistogram[];

// UMA histograms that record app list pref sort order when a session starts.
// Exposed in this header because they are needed in tests.
ASH_PUBLIC_EXPORT extern const char
    kClamshellAppListSortOrderOnSessionStartHistogram[];
ASH_PUBLIC_EXPORT extern const char
    kTabletAppListSortOrderOnSessionStartHistogram[];

// The UMA histogram that records the time duration between the app list sort
// education nudge show and the first sort usage.
ASH_PUBLIC_EXPORT extern const char kAppListSortDiscoveryDurationAfterNudge[];

// Similar to `kAppListSortDiscoveryDurationAfterNudge`. The only difference is
// that the metric data is separated by the tablet mode state under which the
// reorder education nudge shows.
ASH_PUBLIC_EXPORT extern const char
    kAppListSortDiscoveryDurationAfterNudgeClamshell[];
ASH_PUBLIC_EXPORT extern const char
    kAppListSortDiscoveryDurationAfterNudgeTablet[];

// The UMA histogram that records the time duration between the earliest user
// session activation with the app list sort enabled and the first sort usage.
ASH_PUBLIC_EXPORT extern const char
    kAppListSortDiscoveryDurationAfterActivation[];

// The different ways the app list can be shown. These values are written to
// logs.  New enum values can be added, but existing enums must never be
// renumbered or deleted and reused.
enum class AppListShowSource {
  kSearchKey = 0,
  kShelfButton = 1,
  kSwipeFromShelf = 2,
  kTabletMode = 3,
  kSearchKeyFullscreen_DEPRECATED = 4,    // Migrated to kSearchKey.
  kShelfButtonFullscreen_DEPRECATED = 5,  // Obsolete on bubble launcher.
  kAssistantEntryPoint = 6,
  kScrollFromShelf = 7,
  kBrowser = 8,
  kWelcomeTour = 9,
  kMaxValue = kWelcomeTour,
};

// Tracks the conclusion of each search session starting from the search box.
enum class SearchSessionConclusion {
  kQuit = 0,
  kLaunch = 1,
  kAnswerCardSeen = 2,
  kMaxValue = kAnswerCardSeen,
};

// The type of the ChromeSearchResult. This is used for logging so do not
// change the order of this enum. If you add to this enum update
// AppListSearchResult in enums.xml.
enum SearchResultType {
  // A result that forwards an omnibox search result. Use or create OMNIBOX_*
  // instead (Deprecated).
  OMNIBOX_SEARCH_RESULT_DEPRECATED,
  // An app result. Use or create platform specific types below (Deprecated).
  APP_SEARCH_RESULT_DEPRECATED,
  // A search result from the webstore (Deprecated).
  WEBSTORE_SEARCH_RESULT_DEPRECATED,
  // A result that opens a webstore search (Deprecated)
  SEARCH_WEBSTORE_SEARCH_RESULT_DEPRECATED,
  // A result that opens a people search (Deprecated).
  SEARCH_PEOPLE_SEARCH_RESULT_DEPRECATED,
  // A result that opens a suggestion (Deprecated).
  SUGGESTIONS_SEARCH_RESULT_DEPRECATED,
  // A result which is either a local file or drive file.
  LAUNCHER_SEARCH_PROVIDER_RESULT,
  // A result that is an uninstalled app from a Play Store app search.
  PLAY_STORE_UNINSTALLED_APP,
  // A result that is an instant app from a Play Store app search.
  PLAY_STORE_INSTANT_APP,
  // A result that is an answer card.
  ANSWER_CARD,
  // A result that opens a specific activity in an app installed from Play
  // Store.
  PLAY_STORE_APP_SHORTCUT,
  // A result that is a URL.
  OMNIBOX_URL_WHAT_YOU_TYPED,
  // A result which is a bookmark.
  OMNIBOX_BOOKMARK,
  // A result which is a recently visited website.
  OMNIBOX_RECENTLY_VISITED_WEBSITE,
  // A result which is a recently used doc in drive.
  OMNIBOX_RECENT_DOC_IN_DRIVE,
  // A result which is a web query.
  OMNIBOX_WEB_QUERY,
  // A result which was a web query that was previously searched.
  // This should be deprecated after M76.
  OMNIBOX_HISTORY_DEPRECATED,
  // An app result which is an installed playstore app.
  PLAY_STORE_APP,
  // An app result which is an app that was installed on another device.
  PLAY_STORE_REINSTALL_APP,
  // An app result which is an internal app (files, settings, etc).
  INTERNAL_APP_DEPRECATED,
  // An app result which is an extension.
  EXTENSION_APP,
  // A Crostini App Result.
  CROSTINI_APP,
  // An app result which is a quick action in settings.
  SETTINGS_SHORTCUT,
  // An ArcAppDataSearchResult which is a person from contacts.
  APP_DATA_RESULT_PERSON,
  // An ArcAppDataSearchResult which is a note document.
  APP_DATA_RESULT_NOTE_DOCUMENT,
  // An omnibox result which is opened via the assistant.
  ASSISTANT_OMNIBOX_RESULT,
  // A result from omnibox for the query that was previously searched.
  OMNIBOX_SEARCH_HISTORY,
  // A result from omnibox for query suggestion.
  OMNIBOX_SEARCH_SUGGEST,
  // A result from omnibox for the personalized suggestion.
  // Currently, it is used for the user's recent query.
  OMNIBOX_SUGGEST_PERSONALIZED,
  // A zero-state result representing a local file.
  ZERO_STATE_FILE,
  // A result from the Drive QuickAccess provider.
  ZERO_STATE_DRIVE,
  // A result from the Assistant provider.
  ASSISTANT,
  // An OsSettingsResult.
  OS_SETTINGS,
  // A Plugin VM App Result.
  PLUGIN_VM_APP,
  // LaCrOS binary.
  LACROS,
  // A Remote App Result.
  REMOTE_APP,
  // A Borealis App Result.
  BOREALIS_APP,
  // A Help App (aka Explore) Result. For default or help results. There is a
  // different search result type for Updates.
  HELP_APP_DEFAULT,
  // A result from omnibox for query suggestion.
  OMNIBOX_SEARCH_SUGGEST_ENTITY,
  // A result from omnibox for suggested navigation.
  OMNIBOX_NAVSUGGEST,
  // An answer result from Omnibox.
  OMNIBOX_ANSWER,
  // A calculator result from Omnibox.
  OMNIBOX_CALCULATOR,
  // A local file search result.
  FILE_SEARCH,
  // A Drive file search result.
  DRIVE_SEARCH,
  // A Help App result about the "What's new" (Updates) page.
  HELP_APP_UPDATES,
  // A Help App result about the "Discover" page. (Deprecated).
  HELP_APP_DISCOVER_DEPRECATED,
  // A keyboard shortcut result from the Keyboard Shortcut provider.
  KEYBOARD_SHORTCUT,
  // A keyboard shortcut result from the Keyboard Shortcut provider.
  OPEN_TAB,
  // Null result type that indicates that user did not interact with any results
  // in some metrics.
  NO_RESULT,
  // A game search result.
  GAME_SEARCH,
  // A search result for OS personalization options.
  PERSONALIZATION,
  // A Bruschetta App Result.
  BRUSCHETTA_APP,
  // A System Info Answer Card Result.
  SYSTEM_INFO,
  // A local image search result.
  IMAGE_SEARCH,
  // A zero-state result representing a admin template.
  DESKS_ADMIN_TEMPLATE,
  // New app shortcuts.
  APP_SHORTCUTS_V2,
  // Boundary is always last.
  SEARCH_RESULT_TYPE_BOUNDARY
};

// Sub-types defined for zero state file/drive suggestions that indicate
// the reason the file result was suggested.
// Used for metrics - assigned values should not change.
enum class ContinueFileSuggestionType {
  // For zero state drive suggestions - file suggested because the user
  // viewed it recently.
  kViewedDrive = 0,
  // For zero state drive suggestions - file suggested because it was
  // recently modified (usually by another user).
  kModifiedDrive = 1,
  // For zero state drive suggestions - file suggested because the user
  // modified it recently.
  kModifiedByCurrentUserDrive = 2,
  // For zero state drive suggestions - file suggested because it was recently
  // shared with the user.
  kSharedWithUserDrive = 3,
  // For zero state local file suggestions - file suggested because the user
  // viewed it recently.
  kViewedFile = 4,
  // For zero state local file suggestions - file suggested because the user
  // modified it recently.
  kModifiedByCurrentUserFile = 5,
  kMaxValue = kModifiedByCurrentUserFile,
};

ASH_PUBLIC_EXPORT std::string SearchSessionConclusionToString(
    SearchSessionConclusion conclusion);

// Returns true if the `show_source` is one that a user directly triggers.
ASH_PUBLIC_EXPORT bool IsAppListShowSourceUserTriggered(
    AppListShowSource show_source);

ASH_PUBLIC_EXPORT void RecordSearchResultOpenTypeHistogram(
    AppListLaunchedFrom launch_location,
    SearchResultType type,
    bool is_tablet_mode);

ASH_PUBLIC_EXPORT void RecordDefaultSearchResultOpenTypeHistogram(
    SearchResultType type);

ASH_PUBLIC_EXPORT void RecordZeroStateSuggestionOpenTypeHistogram(
    SearchResultType type);

ASH_PUBLIC_EXPORT void RecordLauncherIssuedSearchQueryLength(int query_length);

ASH_PUBLIC_EXPORT void RecordLauncherClickedSearchQueryLength(int query_length);

ASH_PUBLIC_EXPORT void RecordSuccessfulAppLaunchUsingSearch(
    AppListLaunchedFrom launched_from,
    int query_length);

ASH_PUBLIC_EXPORT void ReportPrefOrderClearAction(
    AppListOrderUpdateEvent action,
    bool in_tablet);

ASH_PUBLIC_EXPORT void RecordFirstSearchResult(SearchResultType type,
                                               bool in_tablet);

ASH_PUBLIC_EXPORT void ReportPrefSortOrderOnSessionStart(
    ash::AppListSortOrder permanent_order,
    bool in_tablet);

}  // namespace ash

#endif  // ASH_PUBLIC_CPP_APP_LIST_APP_LIST_METRICS_H_