// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.metrics";
option java_outer_classname = "TranslateEventProtos";
package metrics;
// Stores information about a single interaction between a user and
// the Translate UI. Contains features used by Translate Ranker for
// inference, information about the ranker model and its decision, as
// well as user or automated feedback from the Translate UI.
// Next tag: 16
message TranslateEventProto {
// Language strings are two or three letter codes, with sometimes an extra
// suffix (for e.g. chinese zh-TW or zh-CN). See
// https://cs.chromium.org/chromium/src/components/translate/core/browser/translate_language_list.cc
// for a list of supported languages.
// Source language of the translation.
optional string source_language = 1;
// Target language of the translation.
optional string target_language = 2;
// The country where the user is. 2-letter country code. This corresponds to
// the stored permanent country in VariationsService.
optional string country = 14;
// The following counts are extracted from TranslatePrefs.
// The number of times the user accepted a translation for the
// source language.
optional int32 accept_count = 3;
// The number of times the user declined a translation for the
// source language.
optional int32 decline_count = 4;
// The number of times the user ignored a translation for the source
// language.
optional int32 ignore_count = 5;
// Language list from the language settings. These are languages the user
// explicitly set in the language settings.
repeated string language_list = 6;
// The version of the translate ranker model.
optional uint32 ranker_version = 7;
// Timestamp of when the Ranker was queried, in seconds.
// This value comes from Chromium's TimeTicks::Now(), which is an abstract
// time value that is guaranteed to always be increasing (regardless of
// Daylight Saving Time or any other changes to the system clock).
// These numbers are only comparable within a session. To sequence events
// across sessions, order by the |session_id| from the
// ChromeUserMetricsExtension message.
optional int64 ranker_request_timestamp_sec = 8;
// The decision of translate ranker whether we should show the UI or not.
enum RankerResponse {
SHOW = 0;
DONT_SHOW = 1;
NOT_QUERIED = 2;
}
optional RankerResponse ranker_response = 9 [default = NOT_QUERIED];
// The action performed by the user in the translate UI.
// Next tag: 28
enum EventType {
// The feedback event does not correspond to any of the enumerated
// cases.
UNKNOWN = 0;
// User actions.
// The user clicked 'Nope' in the UI.
USER_DECLINE = 1;
// The user clicked 'Translate' in the UI.
USER_ACCEPT = 2;
// The user explicitly closed the UI.
USER_DISMISS = 3;
// The user ignored the UI.
USER_IGNORE = 4;
// The user asked to never translate this source language.
USER_NEVER_TRANSLATE_LANGUAGE = 5;
// The user asked to never translate on this site.
USER_NEVER_TRANSLATE_SITE = 6;
// The user asked to always translate this source language.
USER_ALWAYS_TRANSLATE_LANGUAGE = 7;
// The user explicitly asked for a translation from the context menu.
USER_CONTEXT_MENU_TRANSLATE = 8;
// The user reverted the translation.
USER_REVERT = 9;
// Deprecated. Use AUTO_TRANSLATION_BY_PREF or AUTO_TRANSLATION_BY_LINK
// instead.
AUTOMATICALLY_TRANSLATED = 10;
// Automated feedback.
// An automatic translation was triggered.
// User sets always translate in user settings.
AUTO_TRANSLATION_BY_PREF = 25;
// User navigated through a click from a translated page.
AUTO_TRANSLATION_BY_LINK = 26;
// The translation was not offered because translate is disabled
// globally in the user preferences.
DISABLED_BY_PREF = 11;
// The translation was not offered because this language is
// blacklisted in the user config.
LANGUAGE_DISABLED_BY_USER_CONFIG = 12;
// The translation was not offered because this language or URL is
// blacklisted in the user config.
URL_DISABLED_BY_USER_CONFIG = 13;
// The translation was not offered because this language has been denied too
// many times.
LANGUAGE_DISABLED_BY_AUTO_BLACKLIST = 14;
// The translation was not offered because Ranker dismissed it.
DISABLED_BY_RANKER = 15;
// The translation was not offered because the source or target
// language is not supported.
UNSUPPORTED_LANGUAGE = 16;
// The translation was not offered because the URL is not
// supported (e.g. New Tab Page).
UNSUPPORTED_URL = 17;
// The previous page was in the same language, so the translate UI was
// suppressed.
MATCHES_PREVIOUS_LANGUAGE = 18;
// The translate UI was not shown because the browser window associated with
// the translate event has gone away.
BROWSER_WINDOW_IS_INVALID = 19;
// The translate UI was not shown because the browser window for the
// translate prompt is no longer active.
BROWSER_WINDOW_NOT_ACTIVE = 20;
// The translate UI was not shown because the browser window is minimized.
BROWSER_WINDOW_IS_MINIMIZED = 21;
// The translate UI was not shown because the web context for the translate
// prompt is no longer active.
WEB_CONTENTS_NOT_ACTIVE = 22;
// The translate UI was not shown because the user is editing a form field.
EDITABLE_FIELD_IS_ACTIVE = 23;
// The translate UI was not shown because the language is in the user's User
// Language Profile.
LANGUAGE_IN_ULP = 24;
// Failed to initialize the translate script, this can happen for iOS due
// to CSPs.
INITIALIZATION_ERROR = 27;
}
// Event received from translate UI.
optional EventType event_type = 10;
// Decisions that have been overridden by translate ranker (e.g.
// LANGUAGE_DISABLED_BY_AUTO_BLACKLIST).
repeated EventType decision_overrides = 15;
// The timestamp for the event, in seconds.
// This value comes from Chromium's TimeTicks::Now(), which is an abstract
// time value that is guaranteed to always be increasing (regardless of
// Daylight Saving Time or any other changes to the system clock).
// These numbers are only comparable within a session. To sequence events
// across sessions, order by the |session_id| from the
// ChromeUserMetricsExtension message.
optional int64 event_timestamp_sec = 11;
// Modified source language, if the user changed it. If changed more than
// once, we only keep the last one.
optional string modified_source_language = 12;
// Modified target language, if the user changed it. If changed more than
// once, we only keep the last one.
optional string modified_target_language = 13;
}