Home > Mobile >  keep track of active users - Angular
keep track of active users - Angular

Time:07-26

I have a web page with angular and I need to know the number of active users, it is useless to do it based on the users who have logged in, because perhaps they logged in once and have not entered again, I was thinking that I could track the user click on the modules that I have.

Has anyone had this problem?

any other better idea?

CodePudding user response:

The easiest method I can think of is to use a service that already has a system to track active users on a website like Google analytics, or any other service that can do this.

If you want to build something in house then you will have to have a database where you store the active state of any user and then use that data. How do you determine if a user is online or not? There are lots of ways to do that, each with its own set of pros and cons.

Or you can take the advantage of Firebase's Presence feature to build something that works for you very quick https://firebase.google.com/docs/firestore/solutions/presence

CodePudding user response:

You can count and save to localStorage based on how many users have logged in, and decrement every 60 minutes idle time/log out.

  • Related