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