how to know when the user is in specific part of the website and when he leaves that part and display the data in the admin dashboard

how to know when the user is in specific part of the website and when he leaves that part and display the data in the admin dashboard