If you're not already tracking your users' last login date in your database, you might want to consider it. The storage space footprint is minimal, and it provides another way to keep tabs on your user activity.

It can also be an effective email marketing tool. Imagine if you were able to tailor an e-newsletter to only those users who haven't logged in for over a year. You could explain the changes to your site that have happened since they last logged in. Not to mention the effect of personalizing an opening line, such as

"We haven't seen you in months!"  or "We haven't seen you in years!"

On the technical side, if you are concerned about space, use only your databases date field, as it uses less space than a full timestamp field. However, if space is not an issue, it may not be a bad idea to store the date and time of user's last login.

Keep in mind, you don't want this to be a "default timestamp" field. For example, some databases provide a quick TIMESTAMP field which automatically updates whenever any field in the record is updated. For obvious reasons, this is a bad idea. It will lead to inaccurate last login times. Stick with the DATETIME field, and update it during the user authentication process.


Leave a Reply

Your email address will not be published. Required fields are marked *