The session variable would be set on the detail page, you can do it at the top. Just go to the Server Behaviors tab of the application panel and go to eCart > General > Set Session Variable. In here you can use before page load as the trigger, then for the variable just enter the name of your URL parameter for the id like this:
You will need to make sure that yours matches the name of the URL parameter you use for the item id.
Once you have got this part working you will be storing the id for the current item in a session variable. Now you can just add a recordset and filter on this session variable value on any page to get details about the last viewed item. To set the recordset just create a new one, select the items table and all columns. In the filter section just select the itemID column, then select 'equals' then select 'session variable' and enter the name of your session variable. That should be all there is to it, if you have any further questions or need any help getting this working let us know.