Skip to content

Commit

Permalink
Add uma logging for user visit language settings.
Browse files Browse the repository at this point in the history
[email protected]

(cherry picked from commit b350ff3)

Bug: 759410
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ibbd2b67ee368c7cb4fb0daa79aace64fc8c1a95c
Reviewed-on: https://chromium-review.googlesource.com/640273
Reviewed-by: Michael Giuffrida <[email protected]>
Reviewed-by: Jesse Doherty <[email protected]>
Reviewed-by: Dave Schuyler <[email protected]>
Commit-Queue: Renjie Liu <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#499557}
Reviewed-on: https://chromium-review.googlesource.com/654461
Reviewed-by: Marti Wong <[email protected]>
Cr-Commit-Position: refs/branch-heads/3202@{#61}
Cr-Branched-From: fa6a5d8-refs/heads/master@{#499098}
  • Loading branch information
Renjie Liu authored and Marti Wong committed Sep 7, 2017
1 parent 0852b20 commit 36561d3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
28 changes: 28 additions & 0 deletions chrome/browser/resources/settings/languages_page/languages_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ cr.exportPath('settings');
*/
settings.kMenuCloseDelay = 100;

/**
* Name of the language setting is shown uma histogram.
* @type {string}
*/
const LANGUAGE_SETTING_IS_SHOWN_UMA_NAME = 'Translate.LanguageSettingsIsShown';

(function() {
'use strict';

Expand Down Expand Up @@ -58,6 +64,15 @@ Polymer({
*/
detailLanguage_: Object,

/**
* Whether the language settings list is opened.
* @private
*/
languagesOpened_: {
type: Boolean,
observer: 'onLanguagesOpenedChanged_',
},

/** @private */
showAddLanguagesDialog_: Boolean,

Expand Down Expand Up @@ -523,6 +538,19 @@ Polymer({
menu.showAt(/** @type {!Element} */ (e.target));
},

/**
* @param {boolean} newVal The new value of languagesOpened_.
* @param {boolean} oldVal The old value of languagesOpened_.
* @private
*/
onLanguagesOpenedChanged_: function(newVal, oldVal) {
if (!oldVal && newVal) {
chrome.send(
'metricsHandler:recordBooleanHistogram',
[LANGUAGE_SETTING_IS_SHOWN_UMA_NAME, true]);
}
},

/**
* Closes the shared action menu after a short delay, so when a checkbox is
* tapped it can be seen to change state before disappearing.
Expand Down
12 changes: 12 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84039,6 +84039,18 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>

<histogram name="Translate.LanguageSettingsIsShown" enum="BooleanShown">
<owner>[email protected]</owner>
<summary>
Log everytime the language settings page is shown. This can be either user
visits chrome://settings/languages or user visits the advanced languages
card in chrome://settings. With this stat, we will be able to understand how
well the language model is doing by looking into how the number changes over
time. In additiona to that, we are also interested in how many users ever
visit the languages settings card.
</summary>
</histogram>

<histogram name="Translate.LanguageVerification"
enum="TranslateLanguageVerification">
<owner>[email protected]</owner>
Expand Down

0 comments on commit 36561d3

Please sign in to comment.