/    Sign up×
Community /Pin to ProfileBookmark

content managed pages and site stats

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.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscMay 28.2009 — Google analytics will help you out - just sign up and copy and paste a small amount of JS to your index.php page.

Google analytics has a feature that shows you page hits BY TITLE - so as long as your pages have different titles, analytics will pick it up.

I bet the fact that you won't have to write any code to set up your new stats system will make your day! ?
Copy linkTweet thisAlerts:
@MindzaiMay 28.2009 — Analytics also has a decent API if you need to grab data from it to display in an admin panel for example.

PS mod_rewrite is you're friend, it's 2009 after all :p
Copy linkTweet thisAlerts:
@cannon303authorJun 01.2009 — you were right that really has made my day. Thankyou very much!
×

Success!

Help @cannon303 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...