From 7f1e8d1920f0a74d997b891742df48b86198b83c Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Mon, 22 May 2023 16:43:09 +0200 Subject: [PATCH] [GeckoView] Add some telemetry for the toolbar buttons (bug 1829216) --- web/app.js | 3 ++- web/toolbar-geckoview.js | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/web/app.js b/web/app.js index e387fa7a5..26714e516 100644 --- a/web/app.js +++ b/web/app.js @@ -601,7 +601,8 @@ const PDFViewerApplication = { appConfig.toolbar, eventBus, this.l10n, - await this._nimbusDataPromise + await this._nimbusDataPromise, + this.externalServices ); } } else { diff --git a/web/toolbar-geckoview.js b/web/toolbar-geckoview.js index 544f76671..5a3081c97 100644 --- a/web/toolbar-geckoview.js +++ b/web/toolbar-geckoview.js @@ -25,14 +25,18 @@ class Toolbar { #eventBus; + #externalServices; + /** * @param {ToolbarOptions} options * @param {EventBus} eventBus * @param {IL10n} _l10n - Localization service. * @param {Object} nimbusData - Nimbus configuration. + * @param {Object} externalServices - Interface for external services. */ - constructor(options, eventBus, _l10n, nimbusData) { + constructor(options, eventBus, _l10n, nimbusData, externalServices) { this.#eventBus = eventBus; + this.#externalServices = externalServices; const buttons = [ { element: options.download, @@ -84,6 +88,10 @@ class Toolbar { element.addEventListener("click", evt => { if (eventName !== null) { this.#eventBus.dispatch(eventName, { source: this, ...eventDetails }); + this.#externalServices.reportTelemetry({ + type: "gv-buttons", + data: { id: `${element.id}_tapped` }, + }); } }); }