when a user click on your page, and has the ID from the url.
if $GET["id"] is available:
$_SESSION['Tracking'][]= intval($_GET["id"]);
Then you have a program or site where you need to list the viewed conecnts.
$sql= sprintf("select * from table WHERE id IN (%s) " , implode( $_SESSION['Tracking'] )) ;
echo "test in PHPMYADMIN:" . $sql ;
Alternate way is to directly insert the selected values into a stats table with the userID os sessionid... I would prefer this version.