<@498057949541826571> does supertokens log user se...
# support-questions
@rp does supertokens log user sessions? Need a way to tell how much time each user has spent online in the app
hey @Roosh This is generally a tricky thing to calculate accurately. First off, we do not give an estimate of this ourselves. Since the access token verification happens in a stateless manner and the core doesn't know about them.
To calculate this accurately, you will want to: - log successful session verifications that happen in your APIs. In the log, you want to include the user ID and the timestamp. These logs should be saved in a db. - Then, you can run a job which will "club" logs that are within a certain time frame of each other. For example, club all logs that are within 10 mins of each other. - Then you will have a list of these sets and you can calculate the duration of these sets by taking the timestamp of the max log - time of the min log. - Then you would sum all these set's times and you would have an estimate of how much time the user has spent on the app.
Thanks for the help!
Hi @Roosh . Could you elaborate more on this requirement? Why not use an analytics tool (eg: Amplitude, Google analytics) that would provide this information?