News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Most popular topics by view count

Started by wzol, August 12, 2017, 04:15:12 AM

Previous topic - Next topic

wzol

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?

Arantor

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.

wzol

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. 

Arantor

That might fix bots, but doesn't fix the trend that older topics will simply accrue more views just by being around longer.

wzol

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.

Arantor

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.

wzol

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.

Illori

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.

wzol

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.

Arantor

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.

wzol

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.

nend

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.
// 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.

wzol

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?

Advertisement: