I want to record unique visitors on my site, and record unique hits to my articles.
My idea was to make a table in which i would record something like
ip address, article id
But i'm afraid my database will get very large very quickly, and with limited server space.
Does anyone know a way to record the stats in a harddisk-space friendly way?
If you want to do it that way, I don't think you'll have to worry about disk space for a while...
The basic table you mentioned has two rows - the ip address (Varchar 16, I guess) and the article id (int). You might want to track time too, so you can record a new visit if the person returns after x number of minutes/hours. So you add in a bigint for a timestamp and you've got around 24 bytes per row. Add a few bytes for overhead and you've got 36 bytes/row.
At that rate, 100,000 visitors will consume about 3.6mb of server space. You'll probably be safe unless you're getting 10+ thousand hits/day.
Also, to convserve space, you could summarize the data every week or month. Count up how many hits each article got and store it in a smaller table. That way you can wipe down the counter every x weeks and save the space.
Alternatively there are some free stat services on the internet. There was a thread going on about them in one of these forums recently. Find that thread and you'll find a big list of free counter services (but I'm not sure if they use your server space or not).
Good luck,
- Walkere
Use google Anaylatics
This would help u.
And , u can also check some sites that offer free Stat counters and give full details via email.