-
Notifications
You must be signed in to change notification settings - Fork 153
[Improve App Ratings] Display Hooks + Debug Menu #3331
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
Conversation
Generated by 🚫 Danger |
- Add survey presentation tracking methods to Settings - Create UserSatisfactionSurveyManager with entry point logic - Add SurveyEventTracker to handle user actions - Update UserSatisfactionSurveyView to track "Not Really" response - Add new analytics events for survey tracking - Add UserDefaults keys for survey data storage This implements the foundation for context-aware survey prompts based on user engagement patterns and subscription status.
Add survey tracking calls to all entry points specified in the spec: Free user entry points: - Episode completion tracking in PlaybackManager - Episode starring in EpisodeManager - Show rating in RatePodcastViewModel - Filter creation in CreateFilterViewController Plus user entry points: - Plus upgrade tracking in IAPHelper - Folder creation in ColorPreviewFolderView - Bookmark creation in PlaybackManager - Custom theme setting in Theme class (Plus themes only) - Referral sharing in ReferralSendPassVC All triggers now call the appropriate SurveyEventTracker methods which will evaluate survey eligibility and present when appropriate.
- Update UserSatisfactionSurveyManager to public visibility - Update SurveyEventTracker to public visibility - Make shared instances and tracking methods public - This enables access from all targets in the project The survey review prompt logic is now fully implemented according to spec: - All entry points trigger appropriate survey tracking - Frequency and suppression logic respects 30-day and 60-day limits - User subscription status determines which events are eligible - Existing 2.5h listening time review prompt remains unchanged
fa6e1c7
to
9cc9dce
Compare
podcasts/PlaybackManager.swift
Outdated
@@ -1054,6 +1054,7 @@ class PlaybackManager: ServerPlaybackDelegate { | |||
episode.playingStatus = PlayingStatus.completed.rawValue | |||
episode.playedUpTo = episode.duration | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove this extra line
@@ -71,6 +71,7 @@ class RatePodcastViewModel: ObservableObject { | |||
Analytics.shared.track(.ratingScreenSubmitTapped, | |||
properties: ["uuid": podcast.uuid, | |||
"stars": stars]) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove this extra line
|
||
private func mapAnalyticsEventToSurveyTrigger(name: String) -> SurveyTriggerEvent? { | ||
switch name { | ||
case "episode_starred": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using the event name directly here, what do you think of using the enum rawValue like this:
.episodeStarred.rawValue.toSnakeCaseFromCamelCase()
this way if in the future someone changes the events name or removes it they will warned of this dependency.
podcasts/AppDelegate+Analytics.swift
Outdated
@@ -27,6 +27,8 @@ extension AppDelegate { | |||
adapters.append(NotificationsCoordinator.shared) | |||
} | |||
|
|||
adapters.append(UserSatisfactionSurveyManager.shared) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better to put this under a FF check?
podcasts/AppDelegate.swift
Outdated
@@ -159,6 +159,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | |||
} | |||
} | |||
PlaybackManager.shared.updateIdleTimer() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
@@ -52,6 +52,7 @@ struct ColorPreviewFolderView: View { | |||
Button { | |||
let folderUuid = model.createFolder() | |||
Analytics.track(.folderSaved, properties: ["number_of_podcasts": model.selectedPodcastUuids.count, "color": UIColor(model.color).hexString()]) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for changing the code to use analytics. I left some nit comments but I also detected the following behaviours that I want to check with you:
- Survey shows when bookmark creation is still visible
- Survey shows when system share screen is visible, when sharing a referral
@SergioEstevao Should be ready for review when you get a chance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing all the changes!
Closes PCIOS-20 and PCIOS-19
This also adds 4 new analytics events:
userSatisfactionSurveyShown
userSatisfactionSurveyDismissed
userSatisfactionSurveyYesResponse
userSatisfactionSurveyNoResponse
I've added a new debug menu to aid in verifying state, manually present the screen, and reset the various history items:

To test
Free User
Star an episode
3rd completed episode
After creating a filter
Rate a podcast
Plus users
Create a folder
Create or listen to a bookmark
Set a custom theme
Share a Plus referral
2 days after upgrading to Plus
Frequency Logic
These are the rules around re-prompting, which can be checked as a part of the events above.
Checklist
CHANGELOG.md
if necessary.