Support » Plugin: Simple History » Log Page Views

  • Resolved svacontact


    Great plugin. I run a very simple ‘members only’ web site. Simple History logs user logins which is very helpful. I would like to extend that to track the page(s) that each logged-in user visits. I don’t need anything like a stats plugin. Users cannot edit anything, so these are simply page views. I can get the data from Apache logs, but it would be much nicer to view it in Simple History. I suspect this is not difficult, but could use a few pointers on how to code this. Thanks for any help you can give me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Pär Thernström


    Sure, add something like this to your functions.php-file:

    // Log page views by non-admin users
    add_action('wp_footer', function() {
        // Do not log admins
        if (current_user_can('edit_users')) {
        // Log only page views
        if (is_page()) {
            apply_filters('simple_history_log_info', 'A user viewed the page "{page_title}"', [
                'page_title' => get_the_title()
    • This reply was modified 2 years, 3 months ago by . Reason: Add comment to action

    Awesome, works perfectly. Thank you! Can’t believe it was that simple.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Log Page Views’ is closed to new replies.