How do I list all the usernames who visited a given page on my site?
Slimstat allows you to use both shortcodes and direct calls to the plugin’s API.
Shortcodes
You could use:
[slimstat f='recent' w='username']content_id equals current[/slimstat]
This code, pasted in your post’s content area, will list all the usernames that have accessed it during the current month. You can look at the documentation if you need to have a different time range (just today? this year so far? etc)
Direct API / PHP calls
You can add this code to your single.php
$current_post_id = get_the_ID();
include_once( WP_PLUGIN_DIR . '/wp-slimstat/admin/view/wp-slimstat-db.php' );
wp_slimstat_db::init( 'content_id equals ' . $current_post_id );
$array_of_users = wp_slimstat_db::get_recent( 'username' );
// Now loop through the array to display your data