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.
Fix #157: Add Firefox UI telemetry probes
* Add `visit_supported_site` and `hide_toolbar_button` probes. * `hide_toolbar_button` required adding a new experimental API, `customizeUI`, which allows the extension to be notified when the Firefox CustomizeUI module detects the `onWidgetRemoved` event. This event fires any time a widget is removed from the chrome, including browserAction buttons. The widget is identified by a widgetId. * Update METRICS.md to move `uninstall` probe to Appendix, since it is handled by the Addons Manager's event telemetry already.
- Loading branch information
1 parent
502c6c2
commit 121b8d1
Showing
6 changed files
with
136 additions
and
12 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
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": "Description of the event", | ||
"parameters": [ | ||
{ | ||
"name": "widgetId", | ||
"description": "Description of the first callback parameter", | ||
"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