translate_event.proto 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. syntax = "proto2";
  5. option optimize_for = LITE_RUNTIME;
  6. option java_package = "org.chromium.components.metrics";
  7. option java_outer_classname = "TranslateEventProtos";
  8. package metrics;
  9. // Stores information about a single interaction between a user and
  10. // the Translate UI. Contains features used by Translate Ranker for
  11. // inference, information about the ranker model and its decision, as
  12. // well as user or automated feedback from the Translate UI.
  13. // Next tag: 16
  14. message TranslateEventProto {
  15. // Language strings are two or three letter codes, with sometimes an extra
  16. // suffix (for e.g. chinese zh-TW or zh-CN). See
  17. // https://cs.chromium.org/chromium/src/components/translate/core/browser/translate_language_list.cc
  18. // for a list of supported languages.
  19. // Source language of the translation.
  20. optional string source_language = 1;
  21. // Target language of the translation.
  22. optional string target_language = 2;
  23. // The country where the user is. 2-letter country code. This corresponds to
  24. // the stored permanent country in VariationsService.
  25. optional string country = 14;
  26. // The following counts are extracted from TranslatePrefs.
  27. // The number of times the user accepted a translation for the
  28. // source language.
  29. optional int32 accept_count = 3;
  30. // The number of times the user declined a translation for the
  31. // source language.
  32. optional int32 decline_count = 4;
  33. // The number of times the user ignored a translation for the source
  34. // language.
  35. optional int32 ignore_count = 5;
  36. // Language list from the language settings. These are languages the user
  37. // explicitly set in the language settings.
  38. repeated string language_list = 6;
  39. // The version of the translate ranker model.
  40. optional uint32 ranker_version = 7;
  41. // Timestamp of when the Ranker was queried, in seconds.
  42. // This value comes from Chromium's TimeTicks::Now(), which is an abstract
  43. // time value that is guaranteed to always be increasing (regardless of
  44. // Daylight Saving Time or any other changes to the system clock).
  45. // These numbers are only comparable within a session. To sequence events
  46. // across sessions, order by the |session_id| from the
  47. // ChromeUserMetricsExtension message.
  48. optional int64 ranker_request_timestamp_sec = 8;
  49. // The decision of translate ranker whether we should show the UI or not.
  50. enum RankerResponse {
  51. SHOW = 0;
  52. DONT_SHOW = 1;
  53. NOT_QUERIED = 2;
  54. }
  55. optional RankerResponse ranker_response = 9 [default = NOT_QUERIED];
  56. // The action performed by the user in the translate UI.
  57. // Next tag: 28
  58. enum EventType {
  59. // The feedback event does not correspond to any of the enumerated
  60. // cases.
  61. UNKNOWN = 0;
  62. // User actions.
  63. // The user clicked 'Nope' in the UI.
  64. USER_DECLINE = 1;
  65. // The user clicked 'Translate' in the UI.
  66. USER_ACCEPT = 2;
  67. // The user explicitly closed the UI.
  68. USER_DISMISS = 3;
  69. // The user ignored the UI.
  70. USER_IGNORE = 4;
  71. // The user asked to never translate this source language.
  72. USER_NEVER_TRANSLATE_LANGUAGE = 5;
  73. // The user asked to never translate on this site.
  74. USER_NEVER_TRANSLATE_SITE = 6;
  75. // The user asked to always translate this source language.
  76. USER_ALWAYS_TRANSLATE_LANGUAGE = 7;
  77. // The user explicitly asked for a translation from the context menu.
  78. USER_CONTEXT_MENU_TRANSLATE = 8;
  79. // The user reverted the translation.
  80. USER_REVERT = 9;
  81. // Deprecated. Use AUTO_TRANSLATION_BY_PREF or AUTO_TRANSLATION_BY_LINK
  82. // instead.
  83. AUTOMATICALLY_TRANSLATED = 10;
  84. // Automated feedback.
  85. // An automatic translation was triggered.
  86. // User sets always translate in user settings.
  87. AUTO_TRANSLATION_BY_PREF = 25;
  88. // User navigated through a click from a translated page.
  89. AUTO_TRANSLATION_BY_LINK = 26;
  90. // The translation was not offered because translate is disabled
  91. // globally in the user preferences.
  92. DISABLED_BY_PREF = 11;
  93. // The translation was not offered because this language is
  94. // blacklisted in the user config.
  95. LANGUAGE_DISABLED_BY_USER_CONFIG = 12;
  96. // The translation was not offered because this language or URL is
  97. // blacklisted in the user config.
  98. URL_DISABLED_BY_USER_CONFIG = 13;
  99. // The translation was not offered because this language has been denied too
  100. // many times.
  101. LANGUAGE_DISABLED_BY_AUTO_BLACKLIST = 14;
  102. // The translation was not offered because Ranker dismissed it.
  103. DISABLED_BY_RANKER = 15;
  104. // The translation was not offered because the source or target
  105. // language is not supported.
  106. UNSUPPORTED_LANGUAGE = 16;
  107. // The translation was not offered because the URL is not
  108. // supported (e.g. New Tab Page).
  109. UNSUPPORTED_URL = 17;
  110. // The previous page was in the same language, so the translate UI was
  111. // suppressed.
  112. MATCHES_PREVIOUS_LANGUAGE = 18;
  113. // The translate UI was not shown because the browser window associated with
  114. // the translate event has gone away.
  115. BROWSER_WINDOW_IS_INVALID = 19;
  116. // The translate UI was not shown because the browser window for the
  117. // translate prompt is no longer active.
  118. BROWSER_WINDOW_NOT_ACTIVE = 20;
  119. // The translate UI was not shown because the browser window is minimized.
  120. BROWSER_WINDOW_IS_MINIMIZED = 21;
  121. // The translate UI was not shown because the web context for the translate
  122. // prompt is no longer active.
  123. WEB_CONTENTS_NOT_ACTIVE = 22;
  124. // The translate UI was not shown because the user is editing a form field.
  125. EDITABLE_FIELD_IS_ACTIVE = 23;
  126. // The translate UI was not shown because the language is in the user's User
  127. // Language Profile.
  128. LANGUAGE_IN_ULP = 24;
  129. // Failed to initialize the translate script, this can happen for iOS due
  130. // to CSPs.
  131. INITIALIZATION_ERROR = 27;
  132. }
  133. // Event received from translate UI.
  134. optional EventType event_type = 10;
  135. // Decisions that have been overridden by translate ranker (e.g.
  136. // LANGUAGE_DISABLED_BY_AUTO_BLACKLIST).
  137. repeated EventType decision_overrides = 15;
  138. // The timestamp for the event, in seconds.
  139. // This value comes from Chromium's TimeTicks::Now(), which is an abstract
  140. // time value that is guaranteed to always be increasing (regardless of
  141. // Daylight Saving Time or any other changes to the system clock).
  142. // These numbers are only comparable within a session. To sequence events
  143. // across sessions, order by the |session_id| from the
  144. // ChromeUserMetricsExtension message.
  145. optional int64 event_timestamp_sec = 11;
  146. // Modified source language, if the user changed it. If changed more than
  147. // once, we only keep the last one.
  148. optional string modified_source_language = 12;
  149. // Modified target language, if the user changed it. If changed more than
  150. // once, we only keep the last one.
  151. optional string modified_target_language = 13;
  152. }