Welcome to WebmasterWorld Guest from 54.167.185.18

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Making my own PHP counter

Will this slow things down much?

   
4:28 pm on Jun 10, 2004 (gmt 0)

10+ Year Member



I've got a great webhost with good counter software, but since I have multiple domains in the same hosting account the counting is just a big mess. I was wondering if it's feasible for me to create my own php/mysql counter where it just gets the server variable for the ip address, the referring address, the page that was requested, and the date/time - and put them all into a mysql database table. Then I could make a basic php application that reported the total number of pages for which an entry was made into the table and the total number of unique IP address hits. This way I could give potential advertisers the number of hits each page received as well as the number of unique visitors to my site.

Will the fact that I'm writing a few bytes to a mysql code every time I go to a new page affect performance significantly? I probably won't have more than a few thousand hits a month at best, but I don't want to slow people down.

I've heard that AOL and some other ISP's switch the IP addresses of users while they're online. I suppose this could cause a problem because I could count the same person as more than one unique visitor; but the IP certainly wouldn't change every minute or two, would it?

Am I missing something here or do you think this might be suitable for my needs? I really don't need sophisticated analysis of the paths users follow through the site - though I suppose with the information I intend to collect I could manually figure that type of thing out. Thanks in advance for any guidance.

5:19 pm on Jun 10, 2004 (gmt 0)

10+ Year Member



Nah, at this volume, the hit would be unnoticable. A simple routine inserted into your page header would do the job, just collect whatever stats you need..


$_SERVER['REMOTE_ADDR']
@$_SERVER['HTTP_USER_AGENT']
@$_SERVER['HTTP_REFERER']
$_SERVER['REQUEST_URI']

stuff like that. and feed them to the database.
the info is there anyway, it takes almost no time to store it.

;o)
(or