• Hi,

    I want to have a simple activity log table to capture the page started viewing time and end viewing time and userip address for the guest user for a particular Page. Guest user name will be passed to the page as a url parameter.

    Where can I store these simple activity information and retrieve them? I do not want to create a new table in the database just for this purpose. Also I don’t want to use any plugin for this. Can I use any existing wordpress database meta table for storing and retrieving these data?

    Any guidance is much appreciated.

    Thanks.

    • This topic was modified 6 years, 8 months ago by always23.
Viewing 6 replies - 1 through 6 (of 6 total)
  • You may not want to use a plugin (why not use code that is already written and tested?), but from your question it sounds like you don’t know enough to write it yourself.
    You can use https://wordpress.org/plugins/wp-slimstat/ or just read the code to see how to do it.

    Thread Starter always23

    (@always23)

    Hi joy,

    Thanks so much for suggesting to look into the plugin code. Will surely do that. Great help. Much appreciated.

    Moderator bcworkz

    (@bcworkz)

    You can use the meta tables to store any sort of scalar data you might wish to associate with A WP object. Times and IPs would be fine. I suggest storing times either as timestamps or ISO 8601 format (ex: 2019-08-26T15:19:21) to facilitate accurate comparisons and sorting.

    Be advised that querying for this data in very large meta tables can be very time consuming. If you anticipate large meta tables and frequent queries within, and processing time is an important factor, you may want to reconsider making a separate table.

    Thread Starter always23

    (@always23)

    Hi bcworkz,

    Thanks for the suggestion about the date time and advise about the large meta data. As mine is a simple website with less data, I would use the meta table for this time. I would use a separate table when it comes to a huge/complex website. Really appreciate your valuable comment.

    Moderator bcworkz

    (@bcworkz)

    You’re welcome. Happy coding 🙂

    Hi @joyously

    thank you for recommending our plugin!

    Hi @always23

    give Slimstat a try, you’ll be surprised by how useful the data you get is!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Page watching activity log table’ is closed to new replies.