Follow us on Facebook and Twitter!

Top Pages
I was thinking it'd be nice to have a 'top pages' feature.

As in top visited pages across a site, not top commented pages. Since we already have data in 'report viewers', if a time minus 24hr view of that data was 'spitoutable' somewhere on a non admindirectory URL with pagereference and href, in a table sorted by popularity, that could make the basis for quite a cool sidepanel 'most popular recent pages).

fwiw this all came about because you can do it with google APIs but it's such a royal pita that I thought why go through these hoops when commentics already has this data
This is quite fun, I made it, have a look at any pages at to see what it looks like. Scroll down to green box on bottom right. Fwiw, the crucial SQL is:
SELECT page_reference, count(page_reference) as total,page_url FROM `viewers` GROUP BY `page_reference` ORDER BY total DESC LIMIT 0, 10
Nice work! I'll add this to the Recent Comments add-on.
Have you completed the interview?
Thanks! For anyone intending to use this, bear in mind that you have to have a suitable setting in Commentics > Settings > Viewers - I have mine set at 86400 which is 24hrs. That's enough time to have a range of values for my piddly site.
Actually I've just thought of a small improvement? Rather than using a count of pages to sort, add the timestamps instead. You get the same order if the pagecounts all differ, but if there are any pages with the same pagecount, the sort brings more recently viewed pages to the top within that 'same page bracket' rather than the default alphabetical. Which is nicer as it's more granular and means the time setting in viewers can be smaller too. So this query works quite nicely:
mysql_query("SELECT page_reference, page_url, sum(timestamp) as timetotal FROM `viewers` GROUP BY `page_reference` ORDER BY timetotal DESC LIMIT 0, 10");

Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb Custom Layout Options For Individual Pages Methyus 1 1,433 24-Oct-2016, 12:12 PM
Last Post: Steven
  different forms for different pages JLDoty 3 2,220 21-Jul-2012, 11:54 PM
Last Post: JLDoty
  Automatically Register Pages Swizzle 16 9,097 07-Mar-2011, 06:41 PM
Last Post: Ming

Forum Jump:

Users browsing this thread: 1 Guest(s)