Skip to content

Commit

Permalink
Improve Data Reporting for Chromium Keychain User Actions (#2469)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1206488453854252/1206886138223449/f

**Description**:
* Stop firing an error Pixel when the user cancels Keychain password
entry
* Add new non-error pixel for user being prompted for Keychain password
entry
* Add new non-error pixel for user denying keychain access event
  • Loading branch information
aataraxiaa authored Mar 21, 2024
1 parent 03beaaa commit 18cbbda
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ final class ChromiumKeychainPrompt: ChromiumKeychainPrompting {
kSecMatchLimit as String: kSecMatchLimitOne] as [String: Any]

var dataFromKeychain: AnyObject?

// Fire Pixel to help measure rate of password prompt denied actions
Pixel.fire(.passwordImportKeychainPrompt)

let status: OSStatus = SecItemCopyMatching(query as CFDictionary, &dataFromKeychain)

if status == noErr, let passwordData = dataFromKeychain as? Data {
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/DataImport/Model/DataImportViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ struct DataImportViewModel {
switch error {
// chromium user denied keychain prompt error
case let error as ChromiumLoginReader.ImportError where error.type == .userDeniedKeychainPrompt:
Pixel.fire(.dataImportFailed(source: importSource, sourceVersion: importSource.installedAppsMajorVersionDescription(selectedProfile: selectedProfile), error: error))
Pixel.fire(.passwordImportKeychainPromptDenied)
// stay on the same screen
return true

Expand Down
8 changes: 8 additions & 0 deletions DuckDuckGo/Statistics/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ extension Pixel {
case toggleReportDoNotSend
case toggleReportDismiss

// Password Import Keychain Prompt
case passwordImportKeychainPrompt
case passwordImportKeychainPromptDenied

enum Debug {
/// This is a convenience pixel that allows us to fire `PixelKitEvents` using our
/// regular `Pixel.fire()` calls. This is a convenience intermediate step to help ensure
Expand Down Expand Up @@ -694,6 +698,10 @@ extension Pixel.Event {
case .toggleReportDoNotSend: return "m_mac_toggle-report-do-not-send"
case .toggleReportDismiss: return "m_mac_toggle-report-dismiss"

// Password Import Keychain Prompt
case .passwordImportKeychainPrompt: return "m_mac_password_import_keychain_prompt"
case .passwordImportKeychainPromptDenied: return "m_mac_password_import_keychain_prompt_denied"

}
}
}
Expand Down
4 changes: 3 additions & 1 deletion DuckDuckGo/Statistics/PixelParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ extension Pixel.Event {
.privacyProOfferMonthlyPriceClick,
.privacyProOfferYearlyPriceClick,
.privacyProAddEmailSuccess,
.privacyProWelcomeFAQClick:
.privacyProWelcomeFAQClick,
.passwordImportKeychainPrompt,
.passwordImportKeychainPromptDenied:
return nil
}
}
Expand Down

0 comments on commit 18cbbda

Please sign in to comment.