1

I am a new to this kinda implementation. I just wanted to know that, Is there any package in angular which could give the track and details of a user who has logged in .. The details needed to be:

1. Name of the user logged in.

2. Which page/route user is on.

3. Time spent on each page.

Is there any other way to handle this thing?

To save the details we have already a 3rd party application which will store the details.

Your help is much appreciated. Thank you!!!!

3
  • What do you mean by "track"? Showing a widget of some sort?
    – Alejandro
    Commented Feb 1, 2021 at 12:22
  • 1
    @Alejandro no just catch details like how much user has spent time on a particular page, basically an analysis
    – user71494
    Commented Feb 3, 2021 at 9:30
  • matomo.org is an OSS google-analytics alternative, that might suite what you're looking for. I'm not sure about integration to angular. Keep in mind, when using known 3rd party tracking solutions, most ad blockers will have some way of blocking you from getting that data, building your own might be what you are looking for.
    – Lockszmith
    Commented Oct 29, 2021 at 16:49

1 Answer 1

0

This is not really answer, since it doesn't recommend any software. However 1) it is too large for a comment, and 2) it tells you how to code what you are asking for.

1. Name of the user logged in.

You already know that right? You have a login screen where he typed it in, after all. Create a service and tell it about the log in.

2. Which page/route user is on.
3. Time spent on each page.

Each page is a component. Add code to 'ngOnInit()' for each page to tell the service that the user has chanegd page. The service should then start a timer, cancelling any previous timer. You now have the data that you wanted, although length of time on the final page if he navigates away without logging out might be problematic. This is left as an exercise for the reader ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.