Forum Moderators: coopster

Message Too Old, No Replies

Stats Functions

         

brendan3eb

3:00 am on Jul 14, 2004 (gmt 0)

10+ Year Member



Ok, currently I store ips in a mysql database and check if a visitors ip matches any of the ips in the database to track new visitors. Is there an easier way to track new and unique visitors with php, because this current method is taking up alot of server speed with all the sql queries.

rlkanter

5:40 am on Jul 14, 2004 (gmt 0)

10+ Year Member



Is the IP field unique? You could just try to insert the visitors ip address and if it fails you know they're not new? That would bring it down to a single query at least.

jatar_k

5:22 pm on Jul 14, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I prefer to just use a log analyzer after the fact, I have a few php tracking scripts but they are geared towards conversions and referrers. I use webtrends for traffic analysis, I never really thought building a traffic analyzer was worth the time.

brendan3eb

5:38 pm on Jul 15, 2004 (gmt 0)

10+ Year Member



I have been using awstats for the past month, but I get a feeling they are not very, err... realistic. I think that people who remote link my images' hits are recorded to awstats.

jatar_k

5:43 pm on Jul 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



We actually use apache to sort our logs to run stats on.

We sort all image, css and js requests into a specific log.
We also sort all traffic from our own ips into that same log.

It leaves a nice clean access log for stats. Though this is only really an option if you run your own boxes. This way you can darn near just read through it if you want to get an idea of what's going on daily.

httpwebwitch

5:52 pm on Jul 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Webtrends is good - it uses an embedded pixel on your page to send browser data to their server (I've used WebTrendsLive and it's been quite reliable). Especially useful if you want to track some pages but not others.

Another I've tried is a true log analyzer - it's called "Urchin". Very easy to use, but a real pain to get it set up. And if you want to ignore certain pages, directories, or file types, it takes quite a bit of configuration work.

I guess the main benefit of WT is that the "work" of tracking and storing visitor data is offloaded to another server. If you're having problems with runtime efficiency, it's a good solution.

Besides the statistics and charts available from WT, there's nothing impressive about what it does, and if you have the time and inclination you could build something similar for yourself. As I said, it uses javascript to embed a 1x1 pixel image on your page, thusly:

<img src="tracking.yourserver.net/pixel.php?mydata=blahblahblah" width=1 height=1>

When the other server gets a request for the pixel image, it does something with "blahblahblah". It's a technique that's been mentioned here a few times, and I'm always impressed with its simplicity and elegance.

If you're lucky enough to have 2 servers at your disposal, you can mimic what WT does: offload the tracking work to another machine.

good luck!