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

re-add settings pixels #3716

Merged
merged 6 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
46 changes: 45 additions & 1 deletion Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,8 @@ extension Pixel {

// MARK: Pixel Experiment
case pixelExperimentEnrollment

// MARK: Settings
case settingsPresented
case settingsSetAsDefault
case settingsVoiceSearchOn
Expand All @@ -776,6 +778,26 @@ extension Pixel {
case settingsAccessibilityOpen
case settingsAccessiblityTextZoom

case settingsPrivateSearchOpen
case settingsEmailProtectionOpen
case settingsEmailProtectionEnable
case settingsGeneralOpen
case settingsSyncOpen
case settingsAppearanceOpen
case settingsThemeSelectorPressed
case settingsAddressBarTopSelected
case settingsAddressBarBottomSelected
case settingsShowFullURLOn
case settingsShowFullURLOff
case settingsDataClearingOpen
case settingsFireButtonSelectorPressed
case settingsDataClearingClearDataOpen
Copy link
Collaborator

@mallexxx mallexxx Dec 12, 2024

Choose a reason for hiding this comment

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

settingsDataClearingClearDataOpen pixel is not used anywhere

case settingsAutomaticallyClearDataOn
Copy link
Collaborator

Choose a reason for hiding this comment

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

settingsAutomaticallyClearDataOn is fired for every action or timing parameter change in the Automatically Clear Data settings screen

case settingsAutomaticallyClearDataOff
case settingsNextStepsAddAppToDock
case settingsNextStepsAddWidget
case settingsMoreSearchSettings

// Web pixels
case privacyProOfferMonthlyPriceClick
case privacyProOfferYearlyPriceClick
Expand Down Expand Up @@ -956,7 +978,27 @@ extension Pixel.Event {
case .settingsAutoconsentShown: return "m_settings_autoconsent_shown"
case .settingsAutoconsentOn: return "m_settings_autoconsent_on"
case .settingsAutoconsentOff: return "m_settings_autoconsent_off"


case .settingsPrivateSearchOpen: return "m_settings_private_search_open"
case .settingsEmailProtectionOpen: return "m_settings_email_protection_open"
case .settingsEmailProtectionEnable: return "m_settings_email_protection_enable"
case .settingsGeneralOpen: return "m_settings_general_open"
case .settingsSyncOpen: return "m_settings_sync_open"
case .settingsAppearanceOpen: return "m_settings_appearance_open"
case .settingsThemeSelectorPressed: return "m_settings_theme_selector_pressed"
case .settingsAddressBarTopSelected: return "m_settings_address_bar_top_selected"
case .settingsAddressBarBottomSelected: return "m_settings_address_bar_bottom_selected"
case .settingsShowFullURLOn: return "m_settings_show_full_url_on"
case .settingsShowFullURLOff: return "m_settings_show_full_url_off"
case .settingsDataClearingOpen: return "m_settings_data_clearing_open"
case .settingsFireButtonSelectorPressed: return "m_settings_fire_button_selector_pressed"
case .settingsDataClearingClearDataOpen: return "m_settings_data_clearing_clear_data_open"
case .settingsAutomaticallyClearDataOn: return "m_settings_automatically_clear_data_on"
case .settingsAutomaticallyClearDataOff: return "m_settings_automatically_clear_data_off"
case .settingsNextStepsAddAppToDock: return "m_settings_next_steps_add_app_to_dock"
case .settingsNextStepsAddWidget: return "m_settings_next_steps_add_widget"
case .settingsMoreSearchSettings: return "m_settings_more_search_settings"

case .browsingMenuOpened: return "mb"
case .browsingMenuNewTab: return "mb_tb"
case .browsingMenuAddToBookmarks: return "mb_abk"
Expand Down Expand Up @@ -1643,6 +1685,8 @@ extension Pixel.Event {

// MARK: Pixel Experiment
case .pixelExperimentEnrollment: return "pixel_experiment_enrollment"

// MARK: Settings
case .settingsPresented: return "m_settings_presented"
case .settingsSetAsDefault: return "m_settings_set_as_default"
case .settingsVoiceSearchOn: return "m_settings_voice_search_on"
Expand Down
9 changes: 8 additions & 1 deletion DuckDuckGo/AutoClearSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ class AutoClearSettingsViewController: UITableViewController {

decorate()
}


override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
Pixel.fire(pixel: .settingsDataClearingClearDataOpen)
}

private func loadClearDataSettings() -> AutoClearSettingsModel? {
return AutoClearSettingsModel(settings: appSettings)
}
Expand Down Expand Up @@ -152,6 +157,8 @@ class AutoClearSettingsViewController: UITableViewController {
}

@IBAction func onClearDataToggled(_ sender: UISwitch) {
Pixel.fire(pixel: sender.isOn ? .settingsAutomaticallyClearDataOn : .settingsAutomaticallyClearDataOff)

if sender.isOn {
clearDataSettings = AutoClearSettingsModel()
tableView.insertSections(.init(integersIn: Sections.action.rawValue...Sections.timing.rawValue), with: .fade)
Expand Down
8 changes: 7 additions & 1 deletion DuckDuckGo/EmailProtectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ struct EmailProtectionView: View {
.onChange(of: viewModel.shouldShowEmailAlert) { value in
shouldShowEmailAlert = value
}
.onFirstAppear {
Pixel.fire(pixel: .settingsEmailProtectionOpen)
}
}
}

Expand Down Expand Up @@ -90,7 +93,10 @@ struct EmailProtectionViewSettings: View {
// Enable Email Protection
Section {
SettingsCellView(label: UserText.enableEmailProtection,
action: { viewModel.openEmailProtection() },
action: {
viewModel.openEmailProtection()
Pixel.fire(pixel: .settingsEmailProtectionEnable)
},
webLinkIndicator: true,
isButton: true)
}
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/HomeRowInstructionsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class HomeRowInstructionsViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
HomeRowReminder().setShown()
Pixel.fire(pixel: .settingsNextStepsAddAppToDock)
}

@IBAction func dismiss() {
Expand Down
3 changes: 3 additions & 0 deletions DuckDuckGo/PrivateSearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ struct PrivateSearchView: View {
.applySettingsListModifiers(title: UserText.privateSearch,
displayMode: .inline,
viewModel: viewModel)
.onFirstAppear {
Pixel.fire(pixel: .settingsPrivateSearchOpen)
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions DuckDuckGo/SettingsAppearanceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ struct SettingsAppearanceView: View {
.applySettingsListModifiers(title: UserText.settingsAppearanceSection,
displayMode: .inline,
viewModel: viewModel)
.onFirstAppear {
Pixel.fire(pixel: .settingsAppearanceOpen)
}
}
}
3 changes: 3 additions & 0 deletions DuckDuckGo/SettingsDataClearingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ struct SettingsDataClearingView: View {
.applySettingsListModifiers(title: UserText.dataClearing,
displayMode: .inline,
viewModel: viewModel)
.onFirstAppear {
Pixel.fire(pixel: .settingsDataClearingOpen)
}
}
}
3 changes: 3 additions & 0 deletions DuckDuckGo/SettingsGeneralView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@ struct SettingsGeneralView: View {
.applySettingsListModifiers(title: UserText.general,
displayMode: .inline,
viewModel: viewModel)
.onFirstAppear {
Pixel.fire(pixel: .settingsGeneralOpen)
}
}
}
5 changes: 5 additions & 0 deletions DuckDuckGo/SettingsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ final class SettingsViewModel: ObservableObject {
Binding<ThemeName>(
get: { self.state.appTheme },
set: {
Pixel.fire(pixel: .settingsThemeSelectorPressed)
self.state.appTheme = $0
ThemeManager.shared.enableTheme(with: $0)
}
Expand All @@ -118,6 +119,7 @@ final class SettingsViewModel: ObservableObject {
Binding<FireButtonAnimationType>(
get: { self.state.fireButtonAnimation },
set: {
Pixel.fire(pixel: .settingsFireButtonSelectorPressed)
self.appSettings.currentFireButtonAnimation = $0
self.state.fireButtonAnimation = $0
NotificationCenter.default.post(name: AppUserDefaults.Notifications.currentFireButtonAnimationChange, object: self)
Expand All @@ -138,6 +140,7 @@ final class SettingsViewModel: ObservableObject {
self.state.addressBar.position
},
set: {
Pixel.fire(pixel: $0 == .top ? .settingsAddressBarTopSelected : .settingsAddressBarBottomSelected)
self.appSettings.currentAddressBarPosition = $0
self.state.addressBar.position = $0
}
Expand All @@ -148,6 +151,7 @@ final class SettingsViewModel: ObservableObject {
Binding<Bool>(
get: { self.state.showsFullURL },
set: {
Pixel.fire(pixel: $0 ? .settingsShowFullURLOn : .settingsShowFullURLOff)
self.state.showsFullURL = $0
self.appSettings.showFullSiteAddress = $0
}
Expand Down Expand Up @@ -588,6 +592,7 @@ extension SettingsViewModel {
}

func openMoreSearchSettings() {
Pixel.fire(pixel: .settingsMoreSearchSettings)
UIApplication.shared.open(URL.searchSettings)
}

Expand Down
5 changes: 5 additions & 0 deletions DuckDuckGo/SyncSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ class SyncSettingsViewController: UIHostingController<SyncSettingsView> {
syncService.scheduler.requestSyncImmediately()
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
Pixel.fire(pixel: .settingsSyncOpen)
}

func updateOptions() {
syncService.scheduler.requestSyncImmediately()
}
Expand Down
6 changes: 5 additions & 1 deletion DuckDuckGo/WidgetEducationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ struct WidgetEducationView: View {
.padding(.horizontal)
.padding(.top, Const.Padding.top)
}
}.navigationBarTitle(navBarTitle, displayMode: .inline)
}
.navigationBarTitle(navBarTitle, displayMode: .inline)
.onFirstAppear {
Pixel.fire(pixel: .settingsNextStepsAddWidget)
}
}

private var secondParagraphText: Text {
Expand Down
Loading