the Chromium logo

The Chromium Projects

How to Create Metrics?

Why?

We want to collect data from users to track user actions, and help offer better user experience. This document provides instructions on how to use histogram in code and how to document the histograms for the dashboard.

Solution

Step 1: Define Useful Metrics.

Measure exactly what you want and think ahead

For example, Feedback.ChromeOSApp.ExitPath

Step 2: Create Metrics (Feedback.ChromeOS.ExitPath as example.)

e.g. Feedback.ChromeOS.ExitPath will be an Enum Histogram

<histogram name="Feedback.ChromeOSApp.ExitPath" enum="FeedbackAppExitPath"
    expires_after="2023-07-27">
  <owner>longbowei@google.com</owner>
  <owner>xiangdongkong@google.com</owner>
  <owner>cros-device-enablement@google.com</owner>
  <summary>
    Records a summary of the actions the user took before exiting the app. Fires
    when user closes the feedback app, case includes: User quits on search page
    after clicking some help contents; User quits on search page without
    clicking some help contents; User closes on search page because no help
    content is shown(Offline or Search is down); User closes on share data page
    after clicking help content; User closes on share data page without clicking
    help content; User submits feedback after clicking the help content; User
    submits feedback without clicking the help content.
  </summary>
</histogram>
<enum name="FeedbackAppExitPath">
  <int value="0" label="kQuitSearchPageHelpContentClicked"/>
  <int value="1" label="kQuitSearchPageNoHelpContentClicked"/>
  <int value="2" label="kQuitNoResultFound"/>
  <int value="3" label="kQuitShareDataPageHelpContentClicked"/>
  <int value="4" label="kQuitShareDataPageNoHelpContentClicked"/>
  <int value="5" label="kSuccessHelpContentClicked"/>
  <int value="6" label="kSuccessNoHelpContentClicked"/>
</enum>

Example CLs