Relatively Popular: a plugin for Habari

Blog popularity: it’s nice to know what’s popular and what’s not with visitors on a blog and a summary of the most popular entries helps those who’ve not visited before. Thing is, there’s a problem… most blog popularity measures are based on visits for all time, so what if you write a new article?

How it works

The menu on the right uses this plugin: page views are tracked over the last month and the most popular rises to the top. If one article becomes more or less popular, it’ll move in the list. Sounds obvious really, but most popularity trackers collect data for all time, so if an article was really popular last year then it’d still be at the top even if no-one was actually reading it.

My plugin works differently—by storing sequential numbers of page views over consecutive time periods, the ‘old ones’ can be thrown away and the popularity measure is thus always current.

You can also see this at the top of this article, where there’s a page view counter and a small graph showing the trend over the last month.

You can have it too

If you run Habari, you’ll find this plugin in the Habari Extras repo under the name relativelypopular. This plugin works well with Habari 0.7—0.9. Once installed, you can configure the number of time periods it tracks for and the length of one period.

The menu can be shown in a location of your choosing by adding the Relatively Popular Posts block from your theme configuration screen.

Once you’ve let it run for a few days, why not show a mini-graph in your theme by using this:

$RelativelyPopular->sparkline( $content );

I’ll work out a way to get this to display in a sensible manner for those who aren’t comfortable editing their own theme. It should be possible to create a set of options for a non-techie so they can display it where they want, without giving a theme developer a load of work for each option…

1 Response to Relatively Popular: a plugin for Habari

  • Hi Ben, sounds like an interesting plugin for Habari. I’ll check it out as soon as I have a momment…

    Comment by stuchl4n3k 19th Aug 2011, 8:12am