ok, well thats a totally different can of works.
use the Set Cookie value server behavior on the item details page.
on the bindings panel, make sure there is a URL variable binding for the variable used to populate the details page. for example, if the variable that passes the ID is named id:
details.php?id=12
make sure to have a URL variable named id
in the Set Cookie value behavior, click the lightning bolt next to trigger and select the id URL variable.
set the cookie name to viewedItems
and for the value, use the following code:
<?php echo(isset($_COOKIE['viewedItems'])?$_COOKIE['viewedItems'].", ":""); ?><?php echo $_GET['id']; ?>
this will set the cookie with a comma separated list of the ID's.
now using the MySQLi recordset, use the advanced query builder to create the recently Viewed recordset using the IN comparison on the ID column and select the viewedItems cookie as the variable