Skip to content

Commit

Permalink
Merge branch 'main' into T383826
Browse files Browse the repository at this point in the history
tonisevener authored Jan 27, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 9e6cdc0 + 2b03357 commit f9aa60c
Showing 4 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions WMF Framework/Event Platform/EventPlatformClient.swift
Original file line number Diff line number Diff line change
@@ -133,6 +133,7 @@ import WMFData
case appDonorExperience = "app_donor_experience"
case editInteraction = "ios.edit_interaction"
case imageRecommendation = "android.image_recommendation_event"
case articleLinkInteraction = "ios.article_link_interaction"
}

/**
@@ -159,6 +160,7 @@ import WMFData
case watchlist = "/analytics/mobile_apps/ios_watchlists/4.1.0"
case appInteraction = "/analytics/mobile_apps/app_interaction/1.1.0"
case imageRecommendation = "/analytics/mobile_apps/android_image_recommendation_event/1.1.0"
case articleLinkInteraction = "/analytics/mobile_apps/ios_article_link_interaction/1.0.0"
}

/**
8 changes: 8 additions & 0 deletions Wikipedia.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -742,6 +742,9 @@
67B0B88E2BF51E3300480B46 /* ArticleCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B0B88D2BF51E3300480B46 /* ArticleCollectionViewController.swift */; };
67B0B88F2BF51E3300480B46 /* ArticleCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B0B88D2BF51E3300480B46 /* ArticleCollectionViewController.swift */; };
67B0B8902BF51E3300480B46 /* ArticleCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B0B88D2BF51E3300480B46 /* ArticleCollectionViewController.swift */; };
67B278EF2D47CEF300E2DF8A /* ArticleLinkInteractionFunnel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B278EE2D47CEEC00E2DF8A /* ArticleLinkInteractionFunnel.swift */; };
67B278F02D47CEF300E2DF8A /* ArticleLinkInteractionFunnel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B278EE2D47CEEC00E2DF8A /* ArticleLinkInteractionFunnel.swift */; };
67B278F12D47CEF300E2DF8A /* ArticleLinkInteractionFunnel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B278EE2D47CEEC00E2DF8A /* ArticleLinkInteractionFunnel.swift */; };
67B5334128416C0D00C33E13 /* UserDataExportCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B5333B28416A3B00C33E13 /* UserDataExportCache.swift */; };
67B5334228416C0E00C33E13 /* UserDataExportCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B5333B28416A3B00C33E13 /* UserDataExportCache.swift */; };
67B5334328416C0E00C33E13 /* UserDataExportCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B5333B28416A3B00C33E13 /* UserDataExportCache.swift */; };
@@ -3399,6 +3402,7 @@
67AD17FE2C49D3BB0027C630 /* WMFBarButtonItemPopoverMessageViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = WMFBarButtonItemPopoverMessageViewController.storyboard; sourceTree = "<group>"; };
67ADEE9523A2CFFB0000CAF7 /* ArticleWebMessagingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleWebMessagingController.swift; sourceTree = "<group>"; };
67B0B88D2BF51E3300480B46 /* ArticleCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleCollectionViewController.swift; sourceTree = "<group>"; };
67B278EE2D47CEEC00E2DF8A /* ArticleLinkInteractionFunnel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleLinkInteractionFunnel.swift; sourceTree = "<group>"; };
67B5333B28416A3B00C33E13 /* UserDataExportCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDataExportCache.swift; sourceTree = "<group>"; };
67B64D562507DE3E00FA27F3 /* ArticleAsLivingDocSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleAsLivingDocSectionHeaderView.swift; sourceTree = "<group>"; };
67B64D5B2507E9FD00FA27F3 /* ArticleAsLivingDocSmallEventCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleAsLivingDocSmallEventCollectionViewCell.swift; sourceTree = "<group>"; };
@@ -5901,6 +5905,7 @@
0E7AAEEA1C21F4160046B5B6 /* Wikimedia Event Logging */ = {
isa = PBXGroup;
children = (
67B278EE2D47CEEC00E2DF8A /* ArticleLinkInteractionFunnel.swift */,
7AF1B19520A1E14F000C8DFE /* ReadingListsFunnel.swift */,
67E466F9241BED770014149B /* EditHistoryCompareFunnel.swift */,
7A25B1CB20A483F1008C6F29 /* LoginFunnel.swift */,
@@ -10286,6 +10291,7 @@
00D280F7247EFFFE006BEE23 /* Date+Extensions.swift in Sources */,
7A19C64820DD3440000EF7F7 /* BaseExploreFeedSettingsViewController.swift in Sources */,
6782DBD32343FE03003FA21B /* DiffListGroupViewModel.swift in Sources */,
67B278EF2D47CEF300E2DF8A /* ArticleLinkInteractionFunnel.swift in Sources */,
67059DB52260D034009811AA /* SchemeHandler.swift in Sources */,
FFE891462445150B0058B642 /* AppTabBarDelegate.swift in Sources */,
0042812D25E6E841004945B3 /* NYTPhotoCaptionView.m in Sources */,
@@ -11265,6 +11271,7 @@
8307951F2C9DA34F00E453BD /* WatchlistCoordinator.swift in Sources */,
D8CE25961E698E2400DAE2E0 /* MTLValueTransformer+WMFNumericValueTransformer.m in Sources */,
7AF6F76722395BEC00949393 /* EditingWelcomeViewController.swift in Sources */,
67B278F12D47CEF300E2DF8A /* ArticleLinkInteractionFunnel.swift in Sources */,
83C06895292EEF4A00DF1403 /* TalkPageTopicComposeViewController+TalkPageFormattingToolbar.swift in Sources */,
837A15F528DA591E00AAC3FC /* TalkPageCache.swift in Sources */,
BA7683C91F30D87F00A487AA /* ProminentSwitch.swift in Sources */,
@@ -11827,6 +11834,7 @@
7AF6F76822395BEC00949393 /* EditingWelcomeViewController.swift in Sources */,
830795212C9DA34F00E453BD /* WatchlistCoordinator.swift in Sources */,
7A4B333E2136EDED00C6C820 /* UnderlineButton.swift in Sources */,
67B278F02D47CEF300E2DF8A /* ArticleLinkInteractionFunnel.swift in Sources */,
83C06894292EEF4A00DF1403 /* TalkPageTopicComposeViewController+TalkPageFormattingToolbar.swift in Sources */,
D8C4D3DA1FD5D9260089CEC2 /* TUSafariActivity.m in Sources */,
837A15F428DA591E00AAC3FC /* TalkPageCache.swift in Sources */,
37 changes: 37 additions & 0 deletions Wikipedia/Code/ArticleLinkInteractionFunnel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Foundation
import WMF

final class ArticleLinkInteractionFunnel {

static let shared = ArticleLinkInteractionFunnel()

private enum Action: String, Codable {
case navigate = "navigate"
}

private struct Event: EventInterface {
static let schema: EventPlatformClient.Schema = .articleLinkInteraction
let action: Action
let pageID: Int
let wikiID: String

enum CodingKeys: String, CodingKey {
case action = "action"
case pageID = "page_id"
case wikiID = "wiki_db"
}
}

private func logEvent(action: ArticleLinkInteractionFunnel.Action, pageID: Int, project: WikimediaProject) {

let wikiID = project.notificationsApiWikiIdentifier

let event: ArticleLinkInteractionFunnel.Event = ArticleLinkInteractionFunnel.Event(action: action, pageID: pageID, wikiID: wikiID)
EventPlatformClient.shared.submit(stream: .articleLinkInteraction, event: event)
}

func logArticleView(pageID: Int, project: WikimediaProject) {
logEvent(action: .navigate, pageID: pageID, project: project)
}
}

8 changes: 8 additions & 0 deletions Wikipedia/Code/ArticleViewController.swift
Original file line number Diff line number Diff line change
@@ -627,6 +627,14 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi

self.shareIfNecessary()
self.restoreScrollStateIfNecessary()

if let pageID = article.pageID,
let siteURL = self.articleURL.wmf_site,
let project = WikimediaProject(siteURL: siteURL) {
ArticleLinkInteractionFunnel.shared.logArticleView(pageID: pageID.intValue, project: project)
}


self.articleLoadWaitGroup = nil
}
}

0 comments on commit f9aa60c

Please sign in to comment.