I have a productivity app that I'm currently working on which requires a user analytics panel that logs how much time they've studied, including how much time spent on app navigation, how much time spent while timer is running, how much time spent while timer is paused etc...
I've built the app in react native and set up servers written in python for backend processing. My current model is that every user interaction is logged into an array, for example,
[{"data": {"screen": "Settings", "type": "6"}, "date": 1650558805913}, {"data": {"screen": "Home", "type": "6"}, "date": 1650558808312}, {"data": {"screen": "Spaced Repetition", "type": "6"}, "date": 1650558809615}]
where type corresponds to the type of event and date is the timestamp. Right now, I plan on sending this data to the backend. The backend will loop the array and everytime it reaches a specific defined element, such as navigating to a specific screen, it will create an object that corresponds to that screen. All the elements that come after the creation of the object will be processed and logged accordingly into that object until reaching another predefined element in the array.
This, I've found out is a very rudimentary way of doing it and is nowhere near as scalable as I want it to be.