This repository has been archived by the owner on Dec 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from mozilla/157-firefox-ui-probes
Fix #157: Add Firefox UI telemetry probes
- Loading branch information
Showing
9 changed files
with
159 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,16 +261,7 @@ Fired when the user clicks an undo button in a Product Card in the browserAction | |
|
||
### `uninstall` | ||
|
||
Fired when the user uninstalls the extension. | ||
|
||
#### Payload properties | ||
|
||
- `methods`: String | ||
- `'uninstall'` | ||
- `objects`: String | ||
- `'uninstall'` | ||
- `extra_keys`: Object | ||
- `'tracked_prods'` | ||
See Appendix A. | ||
|
||
### `hide_toolbar_button` | ||
|
||
|
@@ -381,3 +372,48 @@ No telemetry will be sent from the extension in the following additional cases: | |
- The user is in a [Private Browsing](https://support.mozilla.org/en-US/kb/private-browsing-use-firefox-without-history?redirectlocale=en-US&redirectslug=Private+Browsing) window | ||
- Preference: `browser.privatebrowsing.autostart` | ||
- [`windows.Window`](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/Window) property: `window.incognito` | ||
|
||
|
||
## Appendices | ||
|
||
### Appendix A: `uninstall` | ||
|
||
Fired when the user uninstalls the extension. | ||
|
||
This event, along with all other add-on lifecycle events, is recorded by the Addons Manager's event telemetry in Firefox. It will exist as part of the `main` ping under `payload.processes.parent.events` as an array in the `events` array. This event will be fired under the `addonsManager` telemetry category. | ||
|
||
#### Sample Ping | ||
|
||
Note: This is a sample ping. The exact value for the extension ID may differ, though the other values are correct. | ||
|
||
```javascript | ||
{ | ||
"type": "main", | ||
// ... | ||
"payload": { | ||
// ... | ||
"processes": { | ||
// ... | ||
"parent": { | ||
// ... | ||
"events": [ | ||
[ | ||
9792, | ||
"addonsManager", | ||
"uninstall", | ||
"extension", | ||
"[email protected]", // the extension ID | ||
{ | ||
"source": "testpilot" | ||
// ... | ||
} | ||
] | ||
] | ||
} | ||
// ... | ||
} | ||
// ... | ||
} | ||
// ... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
/* global ChromeUtils ExtensionAPI ExtensionCommon */ | ||
|
||
this.customizableUI = class extends ExtensionAPI { | ||
getAPI(context) { | ||
ChromeUtils.import('resource://gre/modules/ExtensionCommon.jsm'); | ||
const {EventManager} = ExtensionCommon; | ||
const {CustomizableUI} = ChromeUtils.import('resource:///modules/CustomizableUI.jsm', {}); | ||
return { | ||
customizableUI: { | ||
onWidgetRemoved: new EventManager( | ||
context, | ||
'customizableUI.onWidgetRemoved', | ||
(fire) => { | ||
const toolbarButton = { | ||
onWidgetRemoved(widgetId) { | ||
fire.async(widgetId); | ||
}, | ||
}; | ||
CustomizableUI.addListener(toolbarButton); | ||
return () => { | ||
CustomizableUI.removeListener(toolbarButton); | ||
}; | ||
}, | ||
).api(), | ||
}, | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ | ||
{ | ||
"namespace": "customizableUI", | ||
"events": [ | ||
{ | ||
"name": "onWidgetRemoved", | ||
"type": "function", | ||
"description": "Fired when a widget is removed from the browser chrome", | ||
"parameters": [ | ||
{ | ||
"name": "widgetId", | ||
"description": "The unique identifier for the widget", | ||
"type": "string" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
/** | ||
* Communication from content scripts to the background page for recording | ||
* telemetry events. | ||
* @module | ||
*/ | ||
|
||
export default async function recordEvent(method, object, value = null, extra = null) { | ||
await browser.runtime.sendMessage({ | ||
type: 'telemetry', | ||
method, | ||
object, | ||
value, | ||
extra, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters