P
P
p4p2013-07-30 21:46:18
PHP
p4p, 2013-07-30 21:46:18

Accounting for users, keeping visit statistics?

Dear PHP programmers, I have this question for you). Until now, I have not had to keep such statistics on my own, and now there is not enough experience for implementation.
When implemented in php + mysql, you will have to have at least 2 tables in the database. One, to store information about visiting the site for today, which will record the user's ip, etc. As a result, with attendance of 50,000 per day, the table will receive 50,000 records, which is not attractive to me.
What are the alternatives for implementing such statistics? Or how to implement everything competently without firing cannons?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
N
Nazar Mokrinsky, 2013-07-30
@nazarpc

Are you considering such options as Yandex.Metrica or Google Analytics?
They will give a better picture than your solution, there are too many things to take into account to get good statistics.

K
KEKSOV, 2013-07-30
@KEKSOV

Appetite comes with eating. This is me to the fact that it is unlikely that you just need to count users (by the way, this is not so simple). Most likely, it is still desirable to save the most detailed information about each of them - cookies, request parameters, session variables, and then you also want to log custom events such as adding an item to the cart, etc. etc.
At one time, I implemented the following scheme - there are several, quite loaded, web servers that should not be strained with unnecessary requests to the database. Each of these servers has a simple PHP library that turns each request into a temporary file - everything is very fast and transparent. Further, there is one dedicated server (generally in the office), which queries web servers via cron via HTTP and takes logs accumulated over minutes with information about requests from them. After that, it processes these logs at its own pace and writes them to the statistics database, which runs on its own separate server, which has nothing to do with production servers.
Yes, the raw database turns out to be huge, but no one bothers to calculate some aggregative characteristics every day and delete unnecessary records.
I am ready to share the source codes of my subsystem.

R
Rastishka, 2013-07-31
@Rastishka

Once a day, I ran a script that analyzed the acces log for a day and pulled out all the necessary data from it, which I already saved in the database in the required format. It worked quite quickly.

A
ajaxtelamonid, 2013-07-31
@ajaxtelamonid

Create more tables in which you write the analysis data collected from the first tables. Run cron analysis, once an hour, and/or once a day, depending on how time quantization you need to view this data in statistics. And the data from the first tables can be cleaned over time.

L
lubezniy, 2013-07-31
@lubezniy

Webalizer parses Apache logs every day and generates html pages with statistics.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question