How to check user login history in WordPress

WordPress user login history is a log or record of all login-related activities and events associated with individual user accounts on a WordPress website. This history includes detailed information such as the date and time of each login and the location from which users log in. The primary purpose of WordPress login history within user management is to track user activity, monitor and audit user access, and provide administrators with insights into user activity, login patterns, and potential security threats.

In this article, we will show you how to use the WordPress activity log to check your users’ login history in WordPress. To achieve this, we are going to use two different methods, and we’re not going to use any custom code. We will only use a combination of Users Insights and WordPress to track your user login history.

If you are running a WordPress website, you must be aware of the importance of keeping a close check on your user login history. At times, it becomes pretty difficult to figure out the user login history, especially if you have a number of users on your website. That’s because this can help you find how engaging your site’s content is. Knowing your users’ visit usage patterns can help you filter the most active users.

In such situations, you would require a tool to go through your WordPress activity log and track the logins of your users. This WordPress tutorial talks about the different ways by which you can check user login history in WordPress.

 

wordpress login history

Technically, setting up a full user activity log of all your users’ actions (like failed login attempts and error log monitor) is certainly possible, but this type of setup is usually used for WordPress security reasons, and it can slow down your site and make your user experience worse. That’s why we opt for a lightweight log for your registered WordPress users with the help of a WordPress plugin. This way you’ll still be able to monitor user activity and know the basic information about your user logins without affecting your WordPress site performance.

Checking the WordPress login history of your users

Once you install Users Insights, it will automatically track your user logins. So, data such as last login and number of sessions will be available by default in your WordPress activity log.

Filtering your users by user’s last login date is a quick way to see which users have recently visited your site. You can use it to filter active or inactive users. If, for example, you want a report of all users who visited your site in the last month, you can use this filter:

Registered users who visited the site in the last 30 days

As you may notice, this filter won’t give you a number of visits. Therefore this filter can only be used to manipulate users based on their last login, not based on the total number of times they have visited your site.

Another idea is using the reverse filter and checking all users who haven’t been active in the past 30 days. In this way you can get in touch with them, or send them something interesting that happened lately.

Registered users who haven't visited the site

You can break down your WordPress user login by any other metric you like. For example, you may want to check among your top commenters, which ones have logged in recently:

Recent visitors ranked by comments count

 

How to track user logins through sessions

Another metric that Users Insights tracks is the number of sessions. The session information is going to give you a broader view of your user activity. This field gives you the total number of times a user has logged in. In this way, you’ll know not just when they were last active but how many times they have visited your site in the past.

The basic usage of the sessions field is ordering users by the number of sessions. You can also filter out users by the number of sessions:

 

Registered users sessions log

Just like the last seen filter, the sessions can be used in combination with other filters. In this way, you’ll see how specific user groups behave. For example, you may check among your users with the most posts, and filter only the ones with a high number of sessions.

Most active users ranked by posts count

The sessions are the most important data to look at if you want to log your users’ visits. That’s because the session is storing past data, and if you collect it correctly, you can use it for user activity tracking and notice the change by over time. But how can you do that? Let’s see two different ways in the following sections.

 

Gathering WordPress user login history with segments and user groups

Users Insights has a new feature called segments. This feature is great for tasks like these, where you need to use the same filter over and over, and collect your results.

So you can save the last seen, sessions and any other filters you like as a segment:

Adding recent and active users to a group

Therefore, the segments allow you to easily perform the exact user searches. But now you need a way to store this information. For instance, you may want to check how your users’ sessions change. You can do that by dividing your users into groups, using any criteria you want, for example:

  • Recent logins: Last seen is less than 10 days ago
  • New and active: Date registered is less than 30 days ago + Sessions is bigger than 10
  • Slipping away: Last seen is more than 90 days ago

You can freely change the names, filters, and anything you want in these segments. Then you add your users to their groups, filtering them by the criteria we’ve selected before in our segments:

Addign recent and active users to a group

Now you have this information stored as a group. You can use this next time you want to check if any user has moved away from a group. Search all users from that group who don’t match the group’s criteria anymore. For instance, a user from the “Slipping away” group who visited your site recently.

Users from slipping away who are also recent

And based on that user history information, you can take action. You can, for example, get in touch with them by sending an offer for being such active users.

Now, let’s see some ideas for extending this even further and creating your own user login statistics right from the WordPress dashboard.

 

How to check visited page user history

In addition to WordPress login history data, it’s possible to check the visited pages for your users. This creates a WordPress user history that you can use in your analytics.

In order to do that we need to activate the visit tracking module. It is set under Users Insights > Modules. Then you have some settings regarding the user roles that you want to track:

WordPress page visit tracking select user role

 

Furthermore, it’s possible to set up which post types you want to track. Sometimes we just need information in our store, for example, then it makes no sense to track other types:

WordPress page visit tracking select post type

 

Then a great addition to your WordPress user log is their visited pages. We have two sections to check this. The first option is simply to filter all users who have visited a specific page. For instance, if you have a Gold Plan Subscription and want to check all visitors for that page, you can do it here:

WordPress filter users by visited pages

 

This filter is useful to measure how popular that page is for your user base. In our case, that page was seen by 36 out of 126 users. Hence, in addition to a simple user login history, that’s an option to measure your marketing results.

In addition, the opposite filter is useful as well. It’s possible to filter users who haven’t visited a page. Then you can contact users who haven’t visited important pages. This is done with the has not visited filter:

WordPress filter users by not visited pages
This filter is useful to check user actions as well. For example, it’s possible to check users who have visited your product but haven’t bought it. Then you can get in touch with offers if you want:

WordPress combine page views filters
Furthermore, it’s possible to check your WordPress user history in their user profile. The activity panel shows last visited pages and most visited pages. This gives you a quick overview of your WordPress user history log.

WordPress user visit tracking data

 

These are just the main pages. You can still see the full list if you click the “view all” button. That shows the full WordPress user log.

Using spreadsheets for WordPress user login statistics

Once you’ve gathered the basic information about your users, you can create metrics and expand your understanding about them. The exact metrics depend on your use cases, but let’s see some ideas.

We can export all the users so we can have some data to work with. You can do that with no filters applied so you can have all the user data:

Exporting all WordPress registered users

Once exported, you can import them to your favorite spreadsheet tool (such as Google Spreadsheets or Excel). Then you can create new columns for your desired stats. Here are some ideas:

  • Use the TODAY function and calculate for how long your users have been registered
  • Average the registered time by the number of sessions to figure out the average user logins per month
  • Use the TODAY function to calculate how long it’s been since your users’ last login

 

Conclusion

Today we looked into different methods for reporting your user login data. We showed how this information can be used in different situations, like improving user management, monitoring users for WordPress security reasons, or tracking user engagement. By the end of the day, you should be able to collect data as simple as the last activity and as complex as a detailed login history for all your users.

We hope you enjoyed this article and see you again next time!