I had to do this recently in a custom plugin
The basic idea was this:
add_action( 'wp_footer', 'create_view_entry' ) );
function create_view_entry()
{
$uid = get_current_user_id();
if ( $uid != 0 && is_single() )
$wpdb->insert( $this->tableName, array( 'uid' => $uid, 'pid' => $post->ID, 'date' => current_time( 'mysql' ) ) );
}
This uses a custom database table like this:
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, uid INT NOT NULL, pid INT NOT NULL, date DATETIME not null
Apologies the code is kinda of vague, it was a very particular solution but this should get you started.
My solution included additional post-type and category conditions in the create_entry function
And create a shortcode to query the database and get user’s information