Title: Theory / Important / Chrome / Metrics / Actions
On every note of this deck, unless a note says otherwise:
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/

Name: User action
Definition: An event user did we want to track in a sequence
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome

Question: Where in the code should user action be emitted
Answer: Near the UI interaction.
Emitting deep in implementation code can cause problems because that code may get reused (and thus called more times in more places) or may get called fewer times (due to caching for example). In cases like this, the logged user action would no longer correspond to a meaningful action performed by the user.
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome

Question: When can the same action name be used in multiple place in code?
Answer: If only one place can be reached (e.g. depending on plateform specific code or change of implementation)
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome

Question: How to record the same action in multiple place in the code
Answer: Use a constant string that you reuse in all call to the emit function
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome

Question: When in the user journey should actions be triggered
Answer: When user do an action or see something new
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome

Question: What to do when you have added a user action in your code
Answer: check whether it's emitted and logged on chrome://user-actions
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome
Answer2: Document it in actions.xml
Answer3: send CLs to chromium-metrics-reviews@google.com

Question: What should be in user actions/histogram documentation
Answer: Indicate when it's emitted
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#Local-Histograms
Context: Chrome
Answer2: Note on which platform/version they are used
Answer3: At least one person as owner, ideally a mailing list too
Answer4: had background if necessary
Answer5: Whether the metric is sent only in some conditional case,

Variable: tools/metrics/actions/actions.xml
Meaning: a comprehensive list of Chrome user actions along with the owner and description for each user action.
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome

Instruction: <action name="name"/>
Effect: Add ot the list of actions an action named name as described here
Language: xml
Context: Chrome tools/metrics/actions/actions.xml
<actions>

Instruction: <owner>email</owner>
Effect: Add email as owner of current metric
Language: xml
Context: Chrome tools/metrics/actions/actions.xml
<actions><action>

Instruction: <obsolete>reason</obsolete>
Effect: State that the action has been obsoleted, why, what to use instead
Language: xml
Context: Chrome tools/metrics/actions/actions.xml
<actions><action>

Instruction: <description>description</description>
Effect: Add as much description as needed to explain this metric
Language: xml
Context: Chrome tools/metrics/actions/actions.xml
<actions><action>

Instruction: not_user_triggered="true"
Effect: Indicates that this action is not trigerred by a user. E.g related something shown to them
Language: xml
Context: Chrome tools/metrics/actions/actions.xml
<actions><action>

Question: What to put in an obsolete message
Answer: Date at which they became obsolete
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome
Answer2: Release at which it became obsolete
Answer3: Replacement action if any

Question: Why do we never delete user actions
Answer: Serves to analyze actions recorded in the past
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome
Answer2: Ensure no duplicate name, which may lead to bad metrics since old version of Chrome may still send it

Typ: UserActionTester
Meaning: // This class observes and collects user action notifications that are sent // by the tests, so that they can be examined afterwards for correctness.
Page: https://chromium.googlesource.com/chromium/src/+/HEAD/tools/metrics/actions/
Context: Chrome

Instruction: userActionTester.GetActionCount(user_action)
Context: Chrome
Returns: Number of time |user_action| occurred
Variables: UserActionTester userActionTester

Instruction: userActionTester.GetActionTimes(user_action)
Context: Chrome
Returns: the time values at which the given |user_action| has occurred.
Variables: UserActionTester userActionTester