For #24075: Add PDF download metrics.

upstream-sync
mcarare 2 years ago committed by mergify[bot]
parent f7f475b830
commit 653f149cc2

@ -7397,3 +7397,43 @@ recently_visited_homepage:
data_sensitivity:
- interaction
expires: 114
downloads:
pdf_download_count:
type: counter
lifetime: application
description: |
A counter that indicates how many times a pdf has been downloaded.
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/24075
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/24061
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: 107
metadata:
tags:
- Download
downloaded_pdf_open_count:
type: counter
lifetime: application
description: |
A counter that indicates how many times open button has been clicked
for a downloaded pdf.
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/24075
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/-
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: 107
metadata:
tags:
- Download

@ -130,6 +130,7 @@ import mozilla.components.feature.webauthn.WebAuthnFeature
import mozilla.components.support.base.feature.ActivityResultHandler
import mozilla.components.support.ktx.android.view.enterToImmersiveMode
import mozilla.components.support.ktx.kotlin.getOrigin
import org.mozilla.fenix.GleanMetrics.Downloads
import org.mozilla.fenix.components.toolbar.interactor.BrowserToolbarInteractor
import org.mozilla.fenix.components.toolbar.interactor.DefaultBrowserToolbarInteractor
import org.mozilla.fenix.crashes.CrashContentIntegration
@ -517,6 +518,10 @@ abstract class BaseBrowserFragment :
dynamicDownloadDialog.show()
browserToolbarView.expand()
if (downloadState.contentType == "application/pdf") {
Downloads.pdfDownloadCount.add()
}
}
}

@ -12,6 +12,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
import mozilla.components.browser.state.state.content.DownloadState
import mozilla.components.feature.downloads.AbstractFetchDownloadService
import mozilla.components.feature.downloads.toMegabyteOrKilobyteString
import org.mozilla.fenix.GleanMetrics.Downloads
import org.mozilla.fenix.R
import org.mozilla.fenix.databinding.DownloadDialogLayoutBinding
import org.mozilla.fenix.ext.settings
@ -99,10 +100,16 @@ class DynamicDownloadDialog(
download = downloadState
)
if (downloadState.contentType == "application/pdf") {
Downloads.downloadedPdfOpenCount.add()
}
if (!fileWasOpened) {
onCannotOpenFile(downloadState)
}
dismiss()
}
}

Loading…
Cancel
Save