зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1842646 - Add telemetry for always offer translations r=gregtatum
Adds a new telemetry event that corresponds to toggling the always-offer-translations settings menu item in the Translations panel. Differential Revision: https://phabricator.services.mozilla.com/D186252
This commit is contained in:
Родитель
553e5b6f0d
Коммит
47f009c13c
|
@ -1362,7 +1362,8 @@ var TranslationsPanel = new (class {
|
|||
* Toggle offering translations.
|
||||
*/
|
||||
async onAlwaysOfferTranslations() {
|
||||
TranslationsParent.toggleAutomaticallyPopupPref();
|
||||
const toggledOn = TranslationsParent.toggleAutomaticallyPopupPref();
|
||||
TranslationsParent.telemetry().panel().onAlwaysOfferTranslations(toggledOn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -307,6 +307,17 @@ class Panel {
|
|||
TranslationsTelemetry.logEventToConsole("onTranslateButton");
|
||||
}
|
||||
|
||||
static onAlwaysOfferTranslations(toggledOn) {
|
||||
Glean.translationsPanel.alwaysOfferTranslations.record({
|
||||
flow_id: TranslationsTelemetry.getOrCreateFlowId(),
|
||||
first_interaction: Panel.isFirstUserInteraction(),
|
||||
toggled_on: toggledOn,
|
||||
});
|
||||
TranslationsTelemetry.logEventToConsole(
|
||||
`[${toggledOn ? "✔" : "x"}] onAlwaysOfferTranslations`
|
||||
);
|
||||
}
|
||||
|
||||
static onAlwaysTranslateLanguage(langTag, toggledOn) {
|
||||
Glean.translationsPanel.alwaysTranslateLanguage.record({
|
||||
flow_id: TranslationsTelemetry.getOrCreateFlowId(),
|
||||
|
|
|
@ -2248,12 +2248,18 @@ export class TranslationsParent extends JSWindowActorParent {
|
|||
/**
|
||||
* Toggle the automatically popup pref, which will either
|
||||
* enable or disable translations being offered to the user.
|
||||
*
|
||||
* @returns {boolean}
|
||||
* True if offering translations was enabled by this call.
|
||||
* False if offering translations was disabled by this call.
|
||||
*/
|
||||
static toggleAutomaticallyPopupPref() {
|
||||
const prefValueBeforeToggle = lazy.automaticallyPopupPref;
|
||||
Services.prefs.setBoolPref(
|
||||
"browser.translations.automaticallyPopup",
|
||||
!lazy.automaticallyPopupPref
|
||||
!prefValueBeforeToggle
|
||||
);
|
||||
return !prefValueBeforeToggle;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -410,6 +410,27 @@ translations.panel:
|
|||
- translations-telemetry-alerts@mozilla.com
|
||||
expires: 122
|
||||
|
||||
always_offer_translations:
|
||||
type: event
|
||||
description: >
|
||||
Triggers when the always-offer-translations menuitem is invoked in the translations panel seeings.
|
||||
extra_keys:
|
||||
flow_id: *flow_id
|
||||
first_interaction: *first_interaction
|
||||
toggled_on:
|
||||
type: boolean
|
||||
description: >
|
||||
- Whether the setting was toggled on or off.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842646
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1842646
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- translations-telemetry-alerts@mozilla.com
|
||||
expires: 122
|
||||
|
||||
always_translate_language:
|
||||
type: event
|
||||
description: >
|
||||
|
|
Загрузка…
Ссылка в новой задаче