user385850
user385850

Reputation: 39

How to add per day and total visitors counter

I am developing a website using php, mysql, javascript, html, css.
I want to add a counter in this website. I already added a counter in this website, that counter counts every visitor and show total visitors. But my client requirement is different, he wants different counters.

Example:

Online user = 2

Today visitor = 20

Total visitor = 1500

I don’t know how to add (online user and today visitor). Please help me.

I appreciated in advance.

Upvotes: 1

Views: 2736

Answers (1)

helloandre
helloandre

Reputation: 10721

well, the 'today' user is pretty easy, you can just query all visits since 12:00am today (you ARE putting a timestamp on your visits, right?)

the 'online' would make the assumption that they are at your site for a given period of time. I.E. you could query for visits in the last 3 minutes, and just assume they are still at your site. This is a pretty good 'poor man's online counter'.

EDIT: This is a very generalized approach, not taking into consideration filtering for repeating IP addresses, or doing actual studies to see how long people are actually on your site.

Upvotes: 2

Related Questions