Hi I’ve been developing a content management system for websites for about 2 years now on and off. I’ve learnt PHP through bits I’ve picked up and although I probably don’t write the best / most secure code in the world I know enough to get by.
I’ve just finished a site for a client and he has requested the ability to see site stats which my hosting provides – no problem! Or so I thought! The client said that it would be good to see what pages are being hit the most and here lies a problem.
I have one page ‘index.php’ which serves all of the site content (from the MySQL database) depending on what navigation link a user has selected so: to go to ‘about us’ the link would be something like this:
index.php?section=6&subsection=1
and when someone clicks ‘services’ the link would be:
index.php?section=3&subsection=9
As you can imagine all the site stats are going to show is that index.php has been hit quite a lot with no reference as to exactly what ‘page’ a user is visiting.
I’ve considered altering the CMS so that when the client creates a new page in the database, I could impliment some PHP script to also create a small or even empty PHP file with the same title, and when a user clicks on say, ‘about us’ index.php will include the empty file ‘about_us.php’ and therefore these files can be referenced in the site stats. Only problem is that the stats never show any files that have been included in the make up of the page through PHP.
I am sure you may say that I am trying to ‘fudge it’ but I really don’t want to have to rewrite the whole CMS especially as the site is now live and I need to fix this quickly.
So I was wondering if anyone had any bright ideas as to how I can get datadriven pages or some kind of reference of them to show in my stats???
Help would be really appreciated!
The stats package that my hosting uses is AWStats – but I don’t really know if telling you that would help as I’m sure it generic problem with any stats package.