How to use 'session' to check path history of user
if you just want to track user visiting there are some modules ready for that like user visits . 

or if you want to do something and need to write a module for that then hook_node_view will fire when user is viewing a node . you can implement it like below :

function YOURMODULENAME_node_view($node, $view_mode, $langcode)
{
   global $user; //user data is here
}


now you can do what you want with user.