if you use this way, you can fetch all users which are viewing a member's profile
in database
xf_session_activity table
controller_name = XenForo_ControllerPublic_Member
controller_action = Member
params = user_id=X
controller action is defined for actions, so, u can also check controller_name is equal or not to XenForo_ControllerPublic_Member