--- a/browser/extensions/onboarding/OnboardingTelemetry.jsm
+++ b/browser/extensions/onboarding/OnboardingTelemetry.jsm
@@ -125,30 +125,33 @@ const BASIC_EVENT_SCHEMA = {
* To save server space and make query easier, we track session begin and end but only send pings
* when session end. Therefore the server will get single "onboarding/overlay/notification-session"
* event which includes both `session_begin` and `session_end` timestamp.
*
* We send `session_begin` and `session_end` timestamps instead of `session_duration` diff because
* of analytics engineer's request.
*/
const EVENT_WHITELIST = {
+ // track when bubble class is added
+ "bubble-class-added": {topic: "internal"},
// track when notification is shown
"notification-appear": {
topic: "firefox-onboarding-event2",
category: "notification-interactions",
parent: "notification",
validators: Object.assign({}, BASIC_EVENT_SCHEMA, {
bubble_state: isValidBubbleState,
current_tour_id: hasString,
logo_state: isValidLogoState,
notification_impression: isPositiveInteger,
notification_state: isEmptyString,
target_tour_id: isEmptyString,
width: isMinusOne,
}),
+ sendBubbleState: true,
sendImpression: true,
sendLogoState: true,
},
// track when click the notification close button
"notification-close-button-click": {
topic: "firefox-onboarding-event2",
category: "notification-interactions",
parent: "notification",
@@ -156,16 +159,17 @@ const EVENT_WHITELIST = {
bubble_state: isValidBubbleState,
current_tour_id: hasString,
logo_state: isValidLogoState,
notification_impression: isPositiveInteger,
notification_state: isEmptyString,
target_tour_id: isEmptyString,
width: isMinusOne,
}),
+ sendBubbleState: true,
sendImpression: true,
sendLogoState: true,
},
// track when click the notification Call-To-Action button
"notification-cta-click": {
topic: "firefox-onboarding-event2",
category: "notification-interactions",
parent: "notification",
@@ -173,16 +177,17 @@ const EVENT_WHITELIST = {
bubble_state: isValidBubbleState,
current_tour_id: hasString,
logo_state: isValidLogoState,
notification_impression: isPositiveInteger,
notification_state: isEmptyString,
target_tour_id: hasString,
width: isPositiveInteger,
}),
+ sendBubbleState: true,
sendImpression: true,
sendLogoState: true,
},
// track when notification is finished
"notification-finished": {topic: "internal"},
// track when notification is hidden
"notification-hide": {topic: "internal"},
// The real event name send to the server, alias of notification-session-end
@@ -207,16 +212,17 @@ const EVENT_WHITELIST = {
bubble_state: isValidBubbleState,
current_tour_id: isEmptyString,
logo_state: isValidLogoState,
notification_impression: isMinusOne,
notification_state: isValidNotificationState,
target_tour_id: isEmptyString,
width: isPositiveInteger,
}),
+ sendBubbleState: true,
sendLogoState: true,
sendNotificationState: true,
},
// init onboarding session with session_key and page url
"onboarding-register-session": {topic: "internal"},
// The real event name send to the server, alias of onboarding-session-end
"onboarding-session": {
topic: "firefox-onboarding-session2",
@@ -326,16 +332,18 @@ const EVENT_WHITELIST = {
current_tour_id: hasString,
logo_state: isEmptyString,
notification_impression: isMinusOne,
notification_state: isEmptyString,
target_tour_id: isEmptyString,
width: isMinusOne,
}),
},
+ // track when watermark class is added
+ "watermark-class-added": {topic: "internal"},
};
const OLD_EVENT_WHITELIST = {
// track when click the notification close button
"notification-close-button-click": {topic: "firefox-onboarding-event", category: "notification-interactions"},
// track when click the notification Call-To-Action button
"notification-cta-click": {topic: "firefox-onboarding-event", category: "notification-interactions"},
// track when notification is shown
@@ -410,16 +418,17 @@ let OnboardingTelemetry = {
}
let onboarding_session_id = gUUIDGenerator.generateUUID().toString();
this.state.sessions[session_key] = {
page,
onboarding_session_id,
overlay_session_id: "",
notification_session_id: "",
notification_state: "hide",
+ bubble_state: "bubble",
tour_type,
};
},
process(data) {
if (NEW_TABLE) {
this.processPings(data);
} else {
@@ -439,16 +448,19 @@ let OnboardingTelemetry = {
}
if (!this.state.sessions[session_key]) {
throw new Error(`should pass valid session_key`);
}
if (topic === "internal") {
switch (event) {
+ case "bubble-class-added":
+ this.state.sessions[session_key].bubble_state = "bubble";
+ break;
case "onboarding-session-begin":
this.state.sessions[session_key].onboarding_session_begin = Date.now();
break;
case "onboarding-session-end":
data.event = "onboarding-session";
this._sendPing("firefox-onboarding-session2", data);
break;
case "overlay-session-begin":
@@ -460,25 +472,29 @@ let OnboardingTelemetry = {
this._sendPing("firefox-onboarding-session2", data);
break;
case "notification-finished":
this.state.sessions[session_key].notification_state = "finished";
break;
case "notification-hide":
this.state.sessions[session_key].notification_state = "hide";
break;
- case "notification-session-begin":
+ case "notification-session-begin":
this.state.sessions[session_key].notification_session_id = gUUIDGenerator.generateUUID().toString();
this.state.sessions[session_key].notification_session_begin = Date.now();
this.state.sessions[session_key].notification_state = "show";
+ this.state.sessions[session_key].bubble_state = "dot";
break;
case "notification-session-end":
data.event = "notification-session";
this._sendPing("firefox-onboarding-session2", data);
break;
+ case "watermark-class-added":
+ this.state.sessions[session_key].bubble_state = "hide";
+ break;
}
} else {
this._sendPing(topic, data);
}
},
// send out pings by topic
_sendPing(topic, data) {
@@ -488,29 +504,31 @@ let OnboardingTelemetry = {
let {
current_tour_id = "",
event,
session_key,
target_tour_id = "",
width = -1,
} = data;
let {
+ bubble_state,
notification_session_begin,
notification_session_id,
notification_state,
onboarding_session_begin,
onboarding_session_id,
overlay_session_begin,
overlay_session_id,
page,
tour_type,
} = this.state.sessions[session_key];
let {
category,
parent,
+ sendBubbleState,
sendImpression,
sendLogoState,
sendNotificationState,
} = EVENT_WHITELIST[event];
let session_begin;
let payload;
let session_id;
let root_session_id = onboarding_session_id;
@@ -592,16 +610,17 @@ let OnboardingTelemetry = {
// the field is used to identify how user open the overlay (through default logo or watermark),
// the number of open from notification can be retrieved via `notification-cta-click` event
let logo_state = Services.prefs.getStringPref("browser.onboarding.state", "default");
payload.logo_state = logo_state === "default" ? "logo" : logo_state;
} else {
payload.logo_state = "";
}
payload.notification_state = sendNotificationState ? notification_state : "";
+ payload.bubble_state = sendBubbleState ? bubble_state : "";
this._validatePayload(payload);
this.eventProbe && this.eventProbe.sendPing(payload,
{filter: ONBOARDING_ID});
break;
}
},
processOldPings(data) {
--- a/browser/extensions/onboarding/data_events.md
+++ b/browser/extensions/onboarding/data_events.md
@@ -55,16 +55,17 @@ sessions for onboarding telemetry;r=fisc
| `ua` | [Auto populated by Onyx] The user agent string. | :two:
| `ver` | [Auto populated by Onyx] The version of the Onyx API the ping was sent to. | :one:
# Example Onboarding `event` Log
```js
{
"addon_version": "1.0.0",
+ "bubble_state": ["bubble" | "dot" | "hide"],
"category": ["overlay-interactions"|"notification-interactions"],
"client_id": "374dc4d8-0cb2-4ac5-a3cf-c5a9bc3c602e",
"locale": "en-US",
"logo_state": ["logo" | "watermark"],
"notification_impression": [1-8],
"notification_state": ["show" | "hide" | "finished"],
"page": ["about:newtab" | "about:home"],
"parent_session_id": "{45cddbeb-2bec-4f3a-bada-fb87d4b79a6c}",
@@ -84,16 +85,17 @@ sessions for onboarding telemetry;r=fisc
"date": "2016-03-07",
}
```
| KEY | DESCRIPTION | |
|-----|-------------|:-----:|
| `addon_version` | [Required] The version of the Onboarding addon. | :one:
+| `bubble_state` | [Optional] | One of ["bubble", "dot", "hide"] indicates the current visual state of the speach bubble (content dialog besides the onboarding logo). | :one:
| `category` | [Required] Either ("overlay-interactions", "notification-interactions") to identify which kind of the interaction | :one:
| `client_id` | [Required] An identifier generated by [ClientID](https://github.com/mozilla/gecko-dev/blob/master/toolkit/modules/ClientID.jsm) module to provide an identifier for this device. This data is automatically appended by `ping-centre` module | :one:
| `current_tour_id` | [Optional] id of the current tour. The number of open from notification can be retrieved via 'notification-cta-click event'. We put "" when this field is not relevant to this event | :one:
| `ip` | [Auto populated by Onyx] The IP address of the client. Onyx does use (with the permission) the IP address to infer user's geo-information so that it could prepare the corresponding tiles for the country she lives in. However, Ping-centre will NOT store IP address in the database, where only authorized Mozilla employees can access the telemetry data, and all the raw logs are being strictly managed by the Ops team and will expire according to the Mozilla's data retention policy.| :two:
| `locale` | The browser chrome's language (e.g. en-US). | :two:
| `logo_state` | [Optional] One of ["logo", "watermark"] indicates the overlay is opened while in the default or the watermark state. Open from the notification bar is counted via 'notification-cta-click event'. | :one:
| `notification_impression` | [Optional] An integer to record how many times the current notification tour is shown to the user. Each Notification tour can show not more than 8 times. We put `-1` when this field is not relevant to this event | :one:
| `notification_state` | [Optional] One of ["show", "hide", "finished"] indicates the current notification bar state. | :one:
@@ -124,17 +126,19 @@ Here are all allowed `event` strings tha
| `onboarding-session-begin` | internal event triggered when the onboarding script is inited, will not send out any data. |
| `onboarding-session-end` | internal event triggered when the onboarding script is destroyed. `onboarding-session` event is the actual event that send to the server. |
| `onboarding-session` | event is sent when the onboarding script is destroyed. |
### Onboarding events
| EVENT | DESCRIPTION |
|-----------|---------------------|
+| `bubble-class-added` | internal event triggered when add `onboarding-speech-bubble` class to the overlay icon. |
| `onboarding-logo-click` | triggered when user opens the overlay via clicking the logo. |
+| `watermark-class-added` | internal event triggered when add `onboarding-watermark` class to the overlay icon. |
### Overlay events
| EVENT | DESCRIPTION |
|-----------|---------------------|
| `overlay-close-button-click` | triggered when close the overlay via click the overlay close button. |
| `overlay-close-outside-click` | triggered when close the overlay via click outside of the tour content area. |
| `overlay-cta-click` | event is sent when click the overlay CTA button. |