Skip to content

Commit

Permalink
Merge pull request #4875 from wikimedia/T364049-metrics-fix-2
Browse files Browse the repository at this point in the history
Add filename and recommendation_source to warning action data
  • Loading branch information
mazevedofs authored Jul 3, 2024
2 parents 8a01601 + c7642b0 commit 107eee4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ extension WKImageRecommendationsBottomSheetViewController: WKImageRecommendation
let timeInterval = currentTime.timeIntervalSince(startTime)
if timeInterval <= 5 {
delegate?.imageRecommendationsDidTriggerTimeWarning()
loggingDelegate?.logDialogWarningMessageDidDisplay()

if let currentRecommendation = viewModel.currentRecommendation {
loggingDelegate?.logDialogWarningMessageDidDisplay(fileName: currentRecommendation.imageData.filename, recommendationSource: currentRecommendation.imageData.source)
}

return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public protocol WKImageRecommendationsLoggingDelegate: AnyObject {
func logRejectSurveyDidTapSubmit(rejectionReasons: [String], otherReason: String?, fileName: String, recommendationSource: String)
func logEmptyStateDidAppear()
func logEmptyStateDidTapBack()
func logDialogWarningMessageDidDisplay()
func logDialogWarningMessageDidDisplay(fileName: String, recommendationSource: String)
}

fileprivate final class WKImageRecommendationsHostingViewController: WKComponentHostingController<WKImageRecommendationsView> {
Expand Down
4 changes: 2 additions & 2 deletions Wikipedia/Code/ExploreViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1430,8 +1430,8 @@ extension ExploreViewController: WKImageRecommendationsLoggingDelegate {
ImageRecommendationsFunnel.shared.logBottomSheetDidAppear()
}

func logDialogWarningMessageDidDisplay() {
ImageRecommendationsFunnel.shared.logDialogWarningMessageDidDisplay()
func logDialogWarningMessageDidDisplay(fileName: String, recommendationSource: String) {
ImageRecommendationsFunnel.shared.logDialogWarningMessageDidDisplay(fileName: fileName, recommendationSource: recommendationSource)
}

func logBottomSheetDidTapYes() {
Expand Down
10 changes: 8 additions & 2 deletions Wikipedia/Code/ImageRecommendationsFunnel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,13 @@ final class ImageRecommendationsFunnel: NSObject {
logEvent(activeInterface: .editSummaryDialog, action: .saveFailure, actionData: actionData, project: project)
}

func logDialogWarningMessageDidDisplay() {
logEvent(activeInterface: .recommendedImageToolbar, action: .warning, project: project)
func logDialogWarningMessageDidDisplay(fileName: String, recommendationSource: String) {

let actionData: [String: String] = [
"filename": "\(fileName)",
"recommendation_source": "\(recommendationSource)"
]

logEvent(activeInterface: .recommendedImageToolbar, action: .warning, actionData: actionData, project: project)
}
}

0 comments on commit 107eee4

Please sign in to comment.