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