Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FXIOS-9203 enhanced tracking protection panel telemetry #24252

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions firefox-ios/Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@
AB9CBC082C53B7CD00102610 /* TrackingProtectionStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB9CBC062C53B76400102610 /* TrackingProtectionStateTests.swift */; };
ABB184EB2CB807B300F0689D /* CertificatesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB184EA2CB807B200F0689D /* CertificatesModel.swift */; };
ABB507CF2A136FB2009CAA67 /* UserConversionMetricsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB507CD2A136FB2009CAA67 /* UserConversionMetricsTests.swift */; };
ABCEC0292D3DE2C80040F40D /* TrackingProtectionTelemetry.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABCEC0282D3DE2C30040F40D /* TrackingProtectionTelemetry.swift */; };
ABE4393E2AC432040074FFE1 /* PartnerWebsites.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE4393D2AC432040074FFE1 /* PartnerWebsites.swift */; };
ABE856AD2C75029F00C56F47 /* TrackingProtectionStatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE856AC2C75029F00C56F47 /* TrackingProtectionStatusView.swift */; };
ABEF80D12A24D2BE003F52C4 /* CreditCardBottomSheetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABEF80D02A24D2BE003F52C4 /* CreditCardBottomSheetViewModel.swift */; };
Expand Down Expand Up @@ -8300,6 +8301,7 @@
AB9CBC062C53B76400102610 /* TrackingProtectionStateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackingProtectionStateTests.swift; sourceTree = "<group>"; };
ABB184EA2CB807B200F0689D /* CertificatesModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CertificatesModel.swift; sourceTree = "<group>"; };
ABB507CD2A136FB2009CAA67 /* UserConversionMetricsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserConversionMetricsTests.swift; sourceTree = "<group>"; };
ABCEC0282D3DE2C30040F40D /* TrackingProtectionTelemetry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackingProtectionTelemetry.swift; sourceTree = "<group>"; };
ABE4393D2AC432040074FFE1 /* PartnerWebsites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartnerWebsites.swift; sourceTree = "<group>"; };
ABE856AC2C75029F00C56F47 /* TrackingProtectionStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackingProtectionStatusView.swift; sourceTree = "<group>"; };
ABEF80D02A24D2BE003F52C4 /* CreditCardBottomSheetViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreditCardBottomSheetViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -12617,6 +12619,7 @@
isa = PBXGroup;
children = (
0A4978492C53E63200B1E82A /* TrackingProtectionViewController.swift */,
ABCEC0282D3DE2C30040F40D /* TrackingProtectionTelemetry.swift */,
AB11407B2CAC0CA8005080CE /* TrackigProtectionRedux */,
AB11407D2CAC0D60005080CE /* TrackingProtectionHelpers */,
AB9A0C002C6CBC9100BFA22A /* TrackingProtectionDetailsViewController.swift */,
Expand Down Expand Up @@ -16433,6 +16436,7 @@
3BCE6D3C1CEB9E4D0080928C /* ThirdPartySearchAlerts.swift in Sources */,
5AD3B6742CF625B000AFA1FE /* DefaultBrowserUtil.swift in Sources */,
8A93F86229D36F0F004159D9 /* NavigationController.swift in Sources */,
ABCEC0292D3DE2C80040F40D /* TrackingProtectionTelemetry.swift in Sources */,
E13F8C342928194800BDC8B4 /* PhotonActionSheetSiteHeaderView.swift in Sources */,
C2D71B9B2A3850B4003DEC7A /* ThemedTableViewCellViewModel.swift in Sources */,
C869912F28917688007ACC5C /* WallpaperMetadataLoader.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Common
import Shared

final class TrackingProtectionMiddleware {
private let telemetryWrapper = TrackingProtectionTelemetry()

lazy var trackingProtectionProvider: Middleware<AppState> = { state, action in
let windowUUID = action.windowUUID
switch action.actionType {
Expand Down Expand Up @@ -44,6 +46,7 @@ final class TrackingProtectionMiddleware {
actionType: TrackingProtectionMiddlewareActionType.clearCookies
)
store.dispatch(newAction)
telemetryWrapper.clearCookiesAndSiteData()
}

private func tappedShowClearCookiesAndSiteDataAlert(windowUUID: WindowUUID) {
Expand All @@ -52,6 +55,7 @@ final class TrackingProtectionMiddleware {
actionType: TrackingProtectionMiddlewareActionType.showAlert
)
store.dispatch(newAction)
telemetryWrapper.showClearCookiesAlert()
}

private func dismissScreen(windowUUID: WindowUUID) {
Expand All @@ -60,6 +64,7 @@ final class TrackingProtectionMiddleware {
actionType: TrackingProtectionMiddlewareActionType.dismissTrackingProtection
)
store.dispatch(newAction)
telemetryWrapper.dismissTrackingProtection()
}

private func showTrackingProtectionDetails(windowUUID: WindowUUID) {
Expand All @@ -68,6 +73,7 @@ final class TrackingProtectionMiddleware {
actionType: TrackingProtectionMiddlewareActionType.showTrackingProtectionDetails
)
store.dispatch(newAction)
telemetryWrapper.showTrackingProtectionDetails()
}

private func showBlockedTrackersDetails(windowUUID: WindowUUID) {
Expand All @@ -76,6 +82,7 @@ final class TrackingProtectionMiddleware {
actionType: TrackingProtectionMiddlewareActionType.showBlockedTrackersDetails
)
store.dispatch(newAction)
telemetryWrapper.showBlockedTrackersDetails()
}

private func showTrackingProtectionSettings(windowUUID: WindowUUID) {
Expand All @@ -84,5 +91,6 @@ final class TrackingProtectionMiddleware {
actionType: TrackingProtectionMiddlewareActionType.navigateToSettings
)
store.dispatch(newAction)
telemetryWrapper.tappedShowSettings()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TrackingProtectionDetailsViewController: UIViewController, Themeable {
static let baseCellHeight: CGFloat = 44
static let baseDistance: CGFloat = 20
}
private let telemetryWrapper = TrackingProtectionTelemetry()

// MARK: - UI
private let scrollView: UIScrollView = .build { scrollView in }
Expand Down Expand Up @@ -245,6 +246,7 @@ class TrackingProtectionDetailsViewController: UIViewController, Themeable {
let certificatesController = CertificatesViewController(with: model.getCertificatesModel(),
windowUUID: windowUUID)
self.navigationController?.pushViewController(certificatesController, animated: true)
telemetryWrapper.trackShowCertificates()
}

private func currentTheme() -> Theme {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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/
import Glean

struct TrackingProtectionTelemetry {
func showClearCookiesAlert() {
GleanMetrics.TrackingProtection.showClearCookiesAlert.record()
}

func clearCookiesAndSiteData() {
GleanMetrics.TrackingProtection.tappedClearCookies.record()
}

func showTrackingProtectionDetails() {
GleanMetrics.TrackingProtection.showEtpDetails.record()
}

func showBlockedTrackersDetails() {
GleanMetrics.TrackingProtection.showEtpBlockedTrackersDetails.record()
}

func tappedShowSettings() {
GleanMetrics.TrackingProtection.showEtpSettings.record()
}

func dismissTrackingProtection() {
GleanMetrics.TrackingProtection.dismissEtpPanel.record()
}

func trackShowCertificates() {
GleanMetrics.TrackingProtection.showCertificates.record()
}
}
77 changes: 77 additions & 0 deletions firefox-ios/Client/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4353,6 +4353,83 @@ tracking_protection:
notification_emails:
- [email protected]
expires: "2025-07-01"
show_clear_cookies_alert:
type: event
description: |
Records when the clear cookies alert is shown
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/20371
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/14102
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data review should point this PR

notification_emails:
- [email protected]
expires: "2025-07-01"
show_etp_details:
type: event
description: |
Records when the enhanced tracking protection details screen is shown
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/20371
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/14102
notification_emails:
- [email protected]
expires: "2025-07-01"
show_etp_blocked_trackers_details:
type: event
description: |
Records when the enhanced tracking protection blocked trackers details screen is shown
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/20371
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/14102
notification_emails:
- [email protected]
expires: "2025-07-01"
show_etp_settings:
type: event
description: |
Records when the enhanced tracking protection settings screen is shown
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/20371
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/14102
notification_emails:
- [email protected]
expires: "2025-07-01"
tapped_clear_cookies:
type: event
description: |
Records when the clear cookies button from the etp alert is tapped.
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/20371
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/14102
notification_emails:
- [email protected]
expires: "2025-07-01"
dismiss_etp_panel:
type: event
description: |
Records when the enhanced tracking protection panel is dismissed
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/20371
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/14102
notification_emails:
- [email protected]
expires: "2025-07-01"
show_certificates:
type: event
description: |
Records when the certificates screen from the enhanced tracking protection panel is shown
bugs:
- https://github.com/mozilla-mobile/firefox-ios/issues/20371
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/14102
notification_emails:
- [email protected]
expires: "2025-07-01"
# iOS 14 widget metrics
# m: medium, s: small, l: large
widget:
Expand Down