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

[Analytics Audit] Add year param for all EOY events #2691

Merged
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
2 changes: 1 addition & 1 deletion podcasts/End of Year/Analytics+story.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Foundation

extension Analytics {
static func track(_ event: AnalyticsEvent, story: String) {
Analytics.track(event, properties: ["story": story])
Analytics.track(event, properties: ["story": story, "year": EndOfYear.currentYear.literalValue])
}
}
13 changes: 12 additions & 1 deletion podcasts/End of Year/EndOfYear.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ struct EndOfYear {
var year: Int? {
modelType?.year
}

var literalValue: String {
switch self {
case .y2022:
return "2022"
case .y2023:
return "2023"
case .y2024:
return "2024"
}
}
}

static var isEligible: Bool { eligibilityChecker?.isEligible ?? false }
Expand Down Expand Up @@ -155,7 +166,7 @@ struct EndOfYear {
}

viewController.present(storiesViewController, animated: true, completion: nil)
Analytics.track(.endOfYearStoriesShown, properties: ["source": source.rawValue])
Analytics.track(.endOfYearStoriesShown, properties: ["source": source.rawValue, "year": EndOfYear.currentYear.literalValue])
}

static func share(assets: [Any], model: StoriesModel, storyIdentifier: String = "unknown", onDismiss: (() -> Void)? = nil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct EpilogueStory2023: ShareableStory {

Button(L10n.eoyStoryReplay) {
StoriesController.shared.replay()
Analytics.track(.endOfYearStoryReplayButtonTapped)
Analytics.track(.endOfYearStoryReplayButtonTapped, properties: ["year": "2023"])
}
.buttonStyle(StoriesButtonStyle(color: Constants.backgroundColor, icon: Image("eoy-replay-icon")))
.opacity(renderForSharing ? 0 : 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct EpilogueStory2024: StoryView {
StoryFooter2024(title: L10n.eoy2024EpilogueTitle, description: L10n.eoy2024EpilogueDescription)
Button(L10n.eoyStoryReplay) {
StoriesController.shared.replay()
Analytics.track(.endOfYearStoryReplayButtonTapped)
Analytics.track(.endOfYearStoryReplayButtonTapped, properties: ["year": "2024"])
}
.buttonStyle(BasicButtonStyle(textColor: .black, backgroundColor: Color.clear, borderColor: .black))
.allowsHitTesting(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct PaidStoryWallView2024: View {
.allowsHitTesting(false)
}
.onAppear {
Analytics.track(.endOfYearUpsellShown)
Analytics.track(.endOfYearUpsellShown, properties: ["year": "2024"])
Analytics.track(.endOfYearStoryShown, story: identifier)
}
}
Expand Down
2 changes: 1 addition & 1 deletion podcasts/End of Year/Stories/2024/Ratings2024Story.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct Ratings2024Story: ShareableStory {
Button(L10n.learnAboutRatings) {
pauseState.togglePause()
openURL = true
Analytics.track(.endOfYearLearnRatingsShown)
Analytics.track(.endOfYearLearnRatingsShown, properties: ["year": "2024"])
}
.buttonStyle(BasicButtonStyle(textColor: .black, backgroundColor: Color.clear, borderColor: .black))
.allowsHitTesting(true)
Expand Down
2 changes: 1 addition & 1 deletion podcasts/End of Year/Views/EndOfYearModal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct EndOfYearModal: View {
.applyDefaultThemeOptions()
.onAppear {
Settings.setHasShownModalForEndOfYear(true, year: year)
Analytics.track(.endOfYearModalShown)
Analytics.track(.endOfYearModalShown, properties: ["year": EndOfYear.currentYear.literalValue])
}
}

Expand Down
2 changes: 1 addition & 1 deletion podcasts/End of Year/Views/StoriesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct StoriesView: View {
}
.background(model.primaryBackgroundColor)
.onAppear {
Analytics.track(.endOfYearStoriesFailedToLoad)
Analytics.track(.endOfYearStoriesFailedToLoad, properties: ["year": EndOfYear.currentYear.literalValue])
}
}

Expand Down
Loading