Bug 1849240 - Add an event when a user closes the shopping sidebar r=TravisLong,Gijs

Differential Revision: https://phabricator.services.mozilla.com/D186637
This commit is contained in:
Perry McManis 2023-08-29 22:17:57 +00:00
Родитель 9a9b90c906
Коммит 09b8089eda
4 изменённых файлов: 45 добавлений и 2 удалений

Просмотреть файл

@ -257,6 +257,9 @@ export class ShoppingSidebarChild extends RemotePageChild {
case "reanalyzeClicked":
Glean.shopping.surfaceReanalyzeClicked.record();
break;
case "surfaceClosed":
Glean.shopping.surfaceClosed.record({ source: details });
break;
}
}
}

Просмотреть файл

@ -31,14 +31,18 @@ export class ShoppingSidebarParent extends JSWindowActorParent {
if (event.button > 0) {
return;
}
this.toggleAllSidebars();
this.toggleAllSidebars("urlBar");
}
/**
* Toggles opening or closing all Shopping sidebars.
* Sets the active pref value for all windows to respond to.
* params:
*
* @param {string?} source
* Optional value, describes where the call came from.
*/
static toggleAllSidebars() {
static toggleAllSidebars(source) {
let activeState = Services.prefs.getBoolPref(
ShoppingSidebarParent.SHOPPING_ACTIVE_PREF
);
@ -46,5 +50,8 @@ export class ShoppingSidebarParent extends JSWindowActorParent {
ShoppingSidebarParent.SHOPPING_ACTIVE_PREF,
!activeState
);
if (source == "urlBar" && activeState) {
Glean.shopping.surfaceClosed.record({ source: "addressBarIcon" });
}
}
}

Просмотреть файл

@ -265,6 +265,13 @@ export class ShoppingContainer extends MozLitElement {
handleClick() {
RPMSetPref("browser.shopping.experience2023.active", false);
this.dispatchEvent(
new CustomEvent("ShoppingTelemetryEvent", {
composed: true,
bubbles: true,
detail: ["surfaceClosed", "closeButton"],
})
);
}
}

Просмотреть файл

@ -144,3 +144,29 @@ shopping:
type: string
no_lint:
- COMMON_PREFIX
surface_closed:
type: event
description: |
The user opened the settings menu of the shopping component.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1849240
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1841892
data_sensitivity:
- interaction
expires: 122
notification_emails:
- betling@mozilla.com
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events
extra_keys:
source:
description: >
The source of the close event. For example, whether the shopping
sidebar was closed with the close button or the icon in the
address bar.
type: string
no_lint:
- COMMON_PREFIX