Advertisement:

Author Topic: Most popular topics by view count  (Read 852 times)

Offline wzol

  • Semi-Newbie
  • *
  • Posts: 21
Most popular topics by view count
« on: August 12, 2017, 04:15:12 AM »
I searched a lot, but I think I've missed it somehow: I'm looking for a mod which can list the most popular topics - it would be even better if the time could be set, like 5 most popular topics of the week, month. The result would be the best if it would look like the same as the recent posts: title, author, avatar etc.

PS: I know bots can modify the view count, but still I believe it can work.

Is there a mod like this?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,044
    • Arantor on GitHub
Re: Most popular topics by view count
« Reply #1 on: August 12, 2017, 07:23:13 AM »
The effect bots have on skewing the numbers, plus the implicit bias towards topics that have been around longer (which all can get more views than newer topics) is why no one has done a mod for it: it just doesn't work.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline wzol

  • Semi-Newbie
  • *
  • Posts: 21
Re: Most popular topics by view count
« Reply #2 on: August 13, 2017, 01:28:55 AM »
A workaround for bots could be an alternative counter in the JS part, and increase it when some element is visible in the viewport like the topic header bar, or footer bar. If this works, it might be have other positive consequences. 

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,044
    • Arantor on GitHub
Re: Most popular topics by view count
« Reply #3 on: August 13, 2017, 04:47:49 AM »
That might fix bots, but doesn't fix the trend that older topics will simply accrue more views just by being around longer.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline wzol

  • Semi-Newbie
  • *
  • Posts: 21
Re: Most popular topics by view count
« Reply #4 on: August 13, 2017, 06:35:37 AM »
I've seen this (I have no idea how it works): http://custom.simplemachines.org/mods/index.php?mod=937

It would be nice if I could set a count and timeframe to it, like the 6 most popular topics of the week.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,044
    • Arantor on GitHub
Re: Most popular topics by view count
« Reply #5 on: August 13, 2017, 06:54:28 AM »
It's based on topics with the most posts made in the last 24 hours - one of the few metrics that you really can rely on.

It wouldn't even be that hard to change that mod to support over a week rather than over a day, but it completely disregards view count, as it should.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline wzol

  • Semi-Newbie
  • *
  • Posts: 21
Re: Most popular topics by view count
« Reply #6 on: August 13, 2017, 08:09:00 AM »
I see, that's why it gave me unexpected results when I changed it to a week.  :-\

At least could you suggest me a mod where you can add a "thank you" or similar which works with guests too? I couldn't find one.

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,069
Re: Most popular topics by view count
« Reply #7 on: August 13, 2017, 09:13:07 AM »
why do you want it to work with guests?
since anyone can be a guest without limits applied a guest can thank you a post a million times if they want, so it would skew the results.

Offline wzol

  • Semi-Newbie
  • *
  • Posts: 21
Re: Most popular topics by view count
« Reply #8 on: August 13, 2017, 12:50:09 PM »
You are right, but I'd still like to give a way for the guests to appreciate a great post - it can be limited to cookie, IP, time limit: it doesn't matter, still there are always more readers than registered users, and I'd like my members to see that their post was important for the readers - either they are registered or not.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,044
    • Arantor on GitHub
Re: Most popular topics by view count
« Reply #9 on: August 13, 2017, 12:52:31 PM »
The problem is that without tying it to an account, it's still way too easy to game. Also, if you're genuinely concerned about member participation and seeing that posts are important for consumers, I'm not sure a forum is entirely the best format for what you're doing - the reality of a pure forum is that being part of a community is more important than seeing 'value'. It almost sounds like you're doing a Q&A style forum, for which I'd almost be inclined to look at different software.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline wzol

  • Semi-Newbie
  • *
  • Posts: 21
Re: Most popular topics by view count
« Reply #10 on: August 13, 2017, 01:04:07 PM »
At this point I'm not too concerned about cheating the results - I'm satisfied even with a thank you button, and just push it as many times how much you liked the post. :)

Yes, you are right about the Q&A style, there is a part of the forum which is something that could have been done in system like that - still the other 80% is better in forum style. It was a decision which had to be made, and this 20% would be much better with a "Like"/"Thank you" system.

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: Most popular topics by view count
« Reply #11 on: August 13, 2017, 01:48:23 PM »
I do a trend on one of my sites. You'll have to keep track of one extra row in the database though as having to calculate every topic trend in a page load may be cumbersome.

My Display.php by the view counter code.
Code: [Select]
// Add 1 to the number of views of this topic.
if (empty($_SESSION['last_read_topic']) || $_SESSION['last_read_topic'] != $topic){
$topicinfo['num_views'] = $topicinfo['num_views'] + 1;
$topicinfo['trend'] = round((((max(($topicinfo['karma_good'] - $topicinfo['karma_bad']),0) + $topicinfo['num_replies']) * 10) + $topicinfo['num_views']) / max(((time() - $topicinfo['poster_time']) / $modSettings['trendTime']), 1));
$smcFunc['db_query']('', '
UPDATE {db_prefix}topics
SET num_views = {int:num_views}, trend = {int:trend}
WHERE id_topic = {int:current_topic}',
array(
'current_topic' => $topic,
'num_views' => $topicinfo['num_views'],
'trend' => $topicinfo['trend'],
)
);
$_SESSION['last_read_topic'] = $topic;
}

This is the only way to get some decent results as your going by a average per day, week, month or whatever the variable modSettings['trendTime'] set to.

As you can see it isn't all too difficult, the only hard part is integrating it into where you need it. For me I have a sort option for the message view and front page trending items.

Offline wzol

  • Semi-Newbie
  • *
  • Posts: 21
Re: Most popular topics by view count
« Reply #12 on: August 13, 2017, 02:57:09 PM »
Thank you nend, this looks interesting. What is the story behind using karma in the trend calculation?

Also is it part of a mod, or is this your custom modification?