Bug 1417769 - collect onboarding-noshow-smallscreen and overlay-disappear-resize event for onboarding telemetry;r=fischer,francois
MozReview-Commit-ID: 2UMryC9J4W5
--- a/browser/extensions/onboarding/OnboardingTelemetry.jsm
+++ b/browser/extensions/onboarding/OnboardingTelemetry.jsm
@@ -280,17 +280,17 @@ const EVENT_WHITELIST = {
current_tour_id: hasString,
logo_state: isEmptyString,
notification_impression: isMinusOne,
notification_state: isEmptyString,
target_tour_id: isEmptyString,
}),
},
// track when an overlay is opened and disappeared because the window is resized too small
- "overlay-disapear-resize": {
+ "overlay-disappear-resize": {
topic: "firefox-onboarding-event2",
category: "overlay-interactions",
parent: "overlay-session",
validators: Object.assign({}, BASIC_EVENT_SCHEMA, {
bubble_state: isEmptyString,
current_tour_id: isEmptyString,
logo_state: isEmptyString,
notification_impression: isMinusOne,
--- a/browser/extensions/onboarding/content/onboarding.js
+++ b/browser/extensions/onboarding/content/onboarding.js
@@ -421,41 +421,65 @@ class Onboarding {
session_key: this._session_key,
tour_type: this._tourType,
});
// Destroy on beforeunload. This is to ensure we remove all the stuff we left.
// No any leak out there.
this._window.addEventListener("beforeunload", this);
this._window.addEventListener("resize", this);
+
+ if (this._isSmallScreen) {
+ telemetry({
+ type: "onboarding-noshow-smallscreen",
+ session_key: this._session_key,
+ width: this._roundWindowWidth,
+ });
+ // Don't show the overlay UI before we get to a better, responsive design.
+ this.destroy();
+ return;
+ }
+
this._resizeTimerId =
this._window.requestIdleCallback(() => this._resizeUI());
// start log the onboarding-session when the tab is visible
telemetry({
type: "onboarding-session-begin",
session_key: this._session_key,
});
}
_resizeUI() {
- this._windowWidth = this._window.document.body.getBoundingClientRect().width;
- if (this._windowWidth < ONBOARDING_MIN_WIDTH_PX) {
+ if (this._isSmallScreen) {
+ if (this._overlay && this._overlay.classList.contains("onboarding-opened")) {
+ telemetry({
+ type: "overlay-disappear-resize",
+ session_key: this._session_key,
+ width: this._roundWindowWidth,
+ });
+ }
+
// Don't show the overlay UI before we get to a better, responsive design.
this.destroy();
return;
}
this._initUI();
if (this._isFirstSession && this._windowWidth >= SPEECH_BUBBLE_MIN_WIDTH_PX) {
this._overlayIcon.classList.add("onboarding-speech-bubble");
} else {
this._overlayIcon.classList.remove("onboarding-speech-bubble");
}
}
+ get _isSmallScreen() {
+ this._windowWidth = this._window.document.body.getBoundingClientRect().width;
+ return this._windowWidth < ONBOARDING_MIN_WIDTH_PX;
+ }
+
_initUI() {
if (this.uiInitialized) {
return;
}
this.uiInitialized = true;
this._tourItems = [];
this._tourPages = [];
--- a/browser/extensions/onboarding/data_events.md
+++ b/browser/extensions/onboarding/data_events.md
@@ -118,29 +118,32 @@ For reference, Onyx is a Mozilla owned s
Here are all allowed event `type` strings that defined in `OnboardingTelemetry::EVENT_WHITELIST`.
### Onboarding events
| EVENT | DESCRIPTION |
|-----------|---------------------|
| `onboarding-logo-click` | event is triggered when a user clicks the logo to open the overlay. |
+| `onboarding-noshow-smallscreen` | event is triggered when the onboarding is not visible due to small screen in the 1st load. |
| `onboarding-register-session` | internal event triggered when loading the onboarding module, will not send out any data. |
| `onboarding-session` | event is sent when the tab unload to track the start and end time of the onboarding session. |
| `onboarding-session-begin` | internal event triggered when the onboarding starts, will not send out any data. |
| `onboarding-session-end` | internal event triggered when the onboarding ends, `onboarding-session` event is the actual event that send to the server. |
+
### Overlay events
| EVENT | DESCRIPTION |
|-----------|---------------------|
| `overlay-close-button-click` | event is triggered when a user clicks close overlay button. |
| `overlay-close-outside-click` | event is triggered when a user clicks outside the overlay area to end the tour. |
| `overlay-cta-click` | event is triggered when a user clicks overlay's Call-To-Action button. |
| `overlay-current-tour` | event is sent when a tour is shown in the overlay. |
+| `overlay-disappear-resize` | event is sent when an overlay is opened and disappeared because the window is resized too small. |
| `overlay-nav-click` | event is sent when a user clicks a navigation button in the overlay. |
| `overlay-session` | event is sent when an overlay is closed to track the start and end time of the overlay session. |
| `overlay-session-begin` | internal event triggered when open the overlay, will not send out any data. |
| `overlay-session-end` | internal event is triggered when an overlay session ends. `overlay-session` event is the actual event that send to the server. |
| `overlay-skip-tour` | event is sent when a user clicks `Skip Tour` button in the overlay. |
### Notification events