Background
In 2024-2025 the iOS team built a personalized Wikipedia Year in Review feature T371946. During development and after release, we identified several improvements to the App's local tracking that need to be made in early 2025 so that we have data for the version that releases on Android and iOS in December 2025. that can be made if we iterate on this project with a version for 2025.
Total time spent on the app, or time spent on different articles was the 3rd most popular personalization request from users in the the feedback survey on iOS's year in review.
User stories
- I would like to see my total time spent on the Wikipedia App so I can understand how much I depend on Wikipedia throughout the year.
- I would like to see which articles I spent the most time reading, so I can learn more about my learning journey this year.
Requirements
- Locally store the number of seconds a user spends on an article
- Data should be accessible for use in a Year in Review report / slide, for statistics like
- Total time spent in the App
- Article they spent the most time on
- Average time spent on an article
- Information should be cleared whenever they clear History
Progress
Here's what I think re: subtasks. I can't remember if we discussed approach. Points in brackets.
- Update WMFData core data database to accept new data.
- Increment WMFData's core data database model version. In new version add a number of seconds field to CDPageView.
- Persist initial number of seconds a user viewed article.
- In ArticleViewController, upon disappearance (pushing to new screen, backgrounding, presenting new screen), calculate the number of seconds they were on that screen. Then update the article's page view core data record (will be created in persistPageViewsForWikipediaInReview) with those seconds
- Append any subsequent number of seconds the user viewed the same article. For example, if they background the app from an article, then foreground it later, we need to start a new timer, then when they leave the article, append the new seconds to the initial seconds in the record from step 2.
- Keep a separate track of "total time spent in the app". This is in the requirements, to me it's a different calculation from per-article seconds. We should maybe hook into SessionFunnel's logPreviousSessionEnd seconds and persist those values. I advise just incrementing a mega-basic UserDefaults value with the sessionMilliseconds in that method.
- Clear step 4 data when "Clear history" button is pressed. Steps 2 & 3 data (CDPageView) should already be cleared when this button is press
Engineering Notes
- We already have a boolean value “Was significantly viewed” true or false - if they are on an article for 30 seconds or more, we turn this on. This powers the "Because you read" explore feed card
- We could start tracking the amount of time they spent on an article here instead of or in addition to the boolean value
QA Notes
Please keep an eye out for regressions article loads and in general app performance over time.