Drupal 8: Build "visitor history" using Flag/Rules
Honestly I gave up pretty quickly since it seemed unnecessarily complicated.  I created a very basic module that handles the marking/unmarking via the Flag API.  It has a single hook that looks like this:

function mymodule_node_view(array &amp;$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {

  //UPON VIEWING 'mytype' NODES  
  if($entity-&gt;getType() == 'mytype'){ 

    //CREATE HISTORY FLAGS
    $uid = \Drupal::currentUser()-&gt;id(); //current user
    $flag_id = 'history'; //flag type is named history
    $flag_service = \Drupal::service('flag');
    $flag = $flag_service-&gt;getFlagById($flag_id);

    if($flag-&gt;isFlagged($entity) == '1'){
        //unflag then reflag to update date
        $flag_service-&gt;unflag($flag, $entity);
        $flag_service-&gt;flag($flag, $entity);
    } else {
        //flag it for the first time
        $flag_service-&gt;flag($flag, $entity);
 }   
 }
}