Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: tools/metrics/actions/README.md

Issue 2384323002: Metrics - Add actions/README.md (Closed)
Patch Set: rob's comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/metrics/user_metrics.h ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # User Action Guidelines
2
3 This document gives the best practices on how to use user actions in code and
4 how to document them for the dashboard. User actions come with only a name and
5 a timestamp. They are best used when you care about a sequence--which actions
6 happen in what order. If you don't care about the order, you should be using
7 histograms (likely enumerated histograms).
8
9 Often, you want both user actions and histogram logging in your code. They
10 enable different analyses. They're complementary.
11
12 [TOC]
13
14 ## Emitting to User Actions
15
16 ### Emit Once Per Action
17
18 A user action should be tied to an actual action taken by a user. Each
19 meaningful unit of action should cause one emit.
20
21 ### Emit at a High-Level, not Deep in the Implementation
22
23 Prefer to emit at the highest level reasonable, closest to the code that handles
24 the UI interaction. Emitting deep in implementation code can cause problems
25 because that code may get reused (and thus called more times in more places) or
26 may get called fewer times (due to caching for example). In cases like this,
27 the logged user action will not longer correspond with a meaningful action by
28 the user.
29
30 ### Do Not Emit Redundantly
31
32 Generally a meaningful user action should cause only one emit. For example, if
33 the browser already has a "Back" user action, it's poor practice to add a
34 "BackViaKeyboardShortcut" user action. This is mostly redundant. (If you're
35 trying to determine the breakdown of keyboard-shortcut backs versus all backs,
36 use a histogram.)
37
38 ### Do Not Emit Excessively
39
40 Again, choose an appropriately-sized meaningful unit. For example, emit
41 "DragScrolled" for a whole scroll action. Don't emit this action every time the
42 user pauses scrolling if the user remains in the process of scrolling (mouse
43 button still down).
44
45 As another example, you may want to emit "FocusOmnibox" (upon focus),
46 "OmniboxEditInProgress" (upon first keystroke), and "OmniboxUse" (upon going
47 somwhere) but forswear "OmniboxKeystroke". That's probably more detailed than
48 you need.
49
50 ### Generally, Do Not Emit Impressions
51
52 It's okay to emit user actions such as "ShowTranslateInfobar" or
53 "DisplayedImageLinkContextMenu". However, more detailed impression information,
54 especially those not caused by the user (as in the second example) and not as
55 attention-grabbing (as in the first example), is often not useful for analyzing
56 sequences of user actions. For example, don't emit
57 "ShowedSecureIconNextToOmnibox".
58
59 ### Testing
60
61 Test your user actions using *chrome://user-actions*. Make sure they're being
62 emitted when you expect and not emitted at other times.
63
64 If this is a general UI surface, please try to check every platform. In
65 particular, check Windows (Views-based platforms), Mac (non-Views), Android
66 phone (yet other UI wrapper code), Android tablet (often triggers lookalike but
67 different menus), and iOS (yet more different UI wrapper code).
68
69 Also, check that your new user action is not mostly redundant with other user
70 actions (see [advice above](#Do-Not-Emit-Redundantly)) and not emitted
71 excessively (see [advice above](#Do-Not-Emit-Excessively)).
72
73 ### Revising User Actions
74
75 If you're changing the semantics of a user action (when it's emitted), make it
76 into a new user action with a new name. Otherwise the dashboard will be mixing
77 two different interpretations of the data and make no sense.
78
79 ## Documenting User Actions
80
81 ### Add User Actions and Documentation in the Same Changelist
82
83 If possible, please add the actions.xml description in the same changelist in
84 which you add the user-action-emitting code. This has several benefits. One,
85 it sometimes happens that the actions.xml reviewer has questions or concerns
86 about the user action description that reveal problems with interpretation of
87 the data and call for a different recording strategy. Two, it allows the user
88 action reviewer to easily review the emission code to see if it comports with
89 these best practices, and to look for other errors.
90
91 ### Understandable to Everyone
92
93 User actions descriptions should be understandable to someone not familiar with
94 your feature. Please add a sentence or two of background if necessary.
95
96 It is good practice to note caveats associated with your user actions in this
97 section, such as which platforms are supported (if the set of supported
98 platforms is surprising). E.g., a desktop feature that happens not to be logged
99 on Mac.
100
101 ### State When It Is Emitted
102
103 User action descriptions should clearly state when the action is emitted.
104
105 ### Owners
106
107 User actions need to be owned by a person or set of people. These indicate who
108 the current experts on it are. Being the owner means you are responsible for
109 answering questions about it, handling the maintenance if there are functional
110 changes. The owners should be added in the original user action description.
111 If you are using a user action heavily and understand it intimately, feel free
112 to add yourself as an owner. @chromium.org email addresses are preferred.
113
114 ### Beware `not_user_action="true"`
115
116 actions.xml allows you to annotate an action as `not_user_action="true"`. This
117 feature should be used rarely. If you think you want to annotate your action
118 thusly, please re-review the best practices above.
119
120 ### Deleting User Action Entries
121
122 Do not delete actions from actions.xml. Instead, mark unused user actions as
123 obsolete, annotating them with the associated date or milestone in the obsolete
124 tag entry. If your user action is being replaced by a new version, we suggest
125 noting that in the previous user action's description.
126
127 Deleting user action entries would be bad if someone accidentally reused your
128 old user action name and which therefore corrupts new data with whatever old
129 data is still coming in. It's also useful to keep obsolete user action
130 descriptions in actions.xml--that way, if someone is searching for a user action
131 to answer a particular question, they can learn if there was a user action at
132 some point that did so even if it isn't active now.
OLDNEW
« no previous file with comments | « base/metrics/user_metrics.h ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698