CMS systems like joomla and wordpress provide some kind of 'most visited pages' statistics. However these counters are quite limited. In joomla for example you can get the total count but not the most popular pages of for example last week.

There are plug-ins and extension that do a more detailed job however most sites are already using an analytics tool like google analytics or piwik to track a website. Wouldn't it be great to use there stats to display a most popular list?

Piwik

Piwik has a nice and relative simple accessible API to query the statistics. So it seems a easy task: give me the pages-urls and page-titles of the most frequent visited pages of the last x-days. Unfortunately you can't query for that. You can get either all page urls or all page titles. So to display the most popular pages you have either to sort them by URL or by TITLE. On a well organized site all titles should be unique so first searching for the most popular pages by title and then getting the most popular url for each given title should give a nice list of most frequently visited pages, although it might not be very accurate.

To start I created a basic script to do exaclty that : fetch the top x pages of a site

Usage

For a test drive unpack the zip, put the .php file on a server and load it into your browser. You should see a top list of logze.nl.

To get your own site change the URL, token and siteid.

SetSegment allows to define segmentation, so you could get pages from a certain part of your site only. Or the top pages visited by users converting a goal etc.

Caching: please be aware that the script is quite heavy, the top 10 pages will result in eleven queries to your piwik site. By default the cache time is set to 6 hours. The populair pages are retrieved for one or more days, so a short cache time doesn't make much sence

Download

piwik.zip

Demo 

Already in joomla

Next step joomla/wordpress plugings