-
-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge branch 'main' into T383826
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters