View Full Version : What's the best way to count the page views?
Mido™
11-01-2009, 10:15 PM
I really want to know which the best way for using to count the page views?
are it using the Google Analytics API , or using the txt file way like in this example (http://www.trap17.com/index.php/php-unique-hit-counter_t8117.html) , or making a mysql table like this example (http://www.configure-all.com/page_view_counter.php) ?
or any other way?
brad211987
11-01-2009, 10:24 PM
I suppose it comes down to personal preference. I tend to lean towards google analytics, or sometimes some server based tools that analyze your server logs (no code required in your html this way).
I do not use Google analytics because it is based on JS and so many poeple have it switched off. I would see no point in having stats which are +/- 30% in accuracy.
So I use my dynamically generated pages to use env variables and to store the data in a mysql table, a bit like your secondly, linked-to example. always stores a page load and the other data I need no matter the users browser, OS or whether they have scripting enabled or not.
bazz
Mido™
11-02-2009, 11:56 AM
I do not use Google analytics because it is based on JS and so many poeple have it switched off. I would see no point in having stats which are +/- 30% in accuracy.
So I use my dynamically generated pages to use env variables and to store the data in a mysql table, a bit like your secondly, linked-to example. always stores a page load and the other data I need no matter the users browser, OS or whether they have scripting enabled or not.
bazz
don't agree with you about JS and many people switched it off,I think now it's rarely to find who switch javascript off,it isn't like cookies for example.
and about the mysql way in this issue,the problem that I see in this way is the size of table,the table will have many thousands of rows,are you agree with me in this?
oesxyl
11-02-2009, 12:04 PM
I really want to know which the best way for using to count the page views?
are it using the Google Analytics API , or using the txt file way like in this example (http://www.trap17.com/index.php/php-unique-hit-counter_t8117.html) , or making a mysql table like this example (http://www.configure-all.com/page_view_counter.php) ?
or any other way?
brad211987 already answer, :) Tools like awstat do that. If you have cpanel and apache you can choose between few tools like that or you can search with google for "server log analiser", choose on of them and install.
best regards
oesxyl
11-02-2009, 12:14 PM
don't agree with you about JS and many people switched it off,I think now it's rarely to find who switch javascript off,it isn't like cookies for example.
js, cookies, referers usualy switch off for about at least 5% of the users, sometimes more depend of many things. This is based on my stats, could very different for others.
and about the mysql way in this issue,the problem that I see in this way is the size of table,the table will have many thousands of rows,are you agree with me in this?
the size of the tables is the last concern, :) There are many things difficult in log analize like broken, fake user agent, visit identification( ansambling the hits for a single visit), parsing, :)
That's why I suggest to use a dedicated tool like awstat or others. The team which mentain that package will update the tools all the time and you can get rid of all this problems. More then that, I don't know about others but from awstat you can export data as xml so you can build your own tool to do what awstat don't do, :)
best regards
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.