How to check user login history in WordPress
In this article we are going to show you how you can check your users’ login history in WordPress. We are going to use different methods combining Users Insights and WordPress to track user logins. By the end of the day, you should be able to create login logs as well as gather your users’ login history on the go. Additionally, we’re not going to use any custom code, but only Users Insights, so using this method is going to be very lightweight.
When you are getting to know your customer base, gathering information about their logins is one of the first steps. That’s because this can help you find how engaging your site’s content is.
Additionally, getting to know your users’ patterns in terms of visits can help you filter the most active users. This helps you analyze each of your customer profiles and reward the best ones.
And finally, we have the technical side. Setting up a full log of all your users’ actions is certainly possible, but 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. In this way you’ll still know the basic information about your user logins, without affecting your site’s performance.
Checking your WordPress users’ last login
Once you install Users Insights, it will start to automatically track your user logins. So, data such as last login and number of sessions will be available by default.
Filtering your users by 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:
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.
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:
How to track user logins through sessions
Another metric that Users Insights tracks is the number of sessions. The sessions information is going to give you a broader view of your user activity. This field gives you the total number of times that 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:
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 amount of posts, and filter only the ones with a high number of sessions.
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 notice the change by that. 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:
Therefore, the segments allow you to easily perform the same user searches. But now you need a way to store this information. For instance, you may want to check how your users’ sessions are changing. 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:
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. Just search all users from that group who doesn’t match the group’s criteria anymore. For instance, a user from the “Slipping away” group, who visited your site recently.
And based on that user history information you can take action. You can, for example, get in touch with them 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.
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:
Once exported, you can import them to your favourite 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
Today we looked into different methods for reporting your user login data. 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!