Hi ,

In one of my web application I want a real visitor count. I am not looking for any third party one. Also I want to know visitors are from which country ?

I wrote a code and that will add in database when each page visit. But if the user refresh the page then also that will add a visit. Really "How real visitor counts are calculating ?" My question is

1. If a user visits my page in morning and it will added into database. After 2 or 3 hours the same visitor visits again.. Then is it count as new visit or ignore that visit and only calculate only one visit per day from a IP address....

I am sorry for my bad grammar and I am expecting good advises
Thanks in advance
Rajeesh

Use cookies or sessions. Just as a user visits the page, create a cookie with an expiry of one day. if the cookie exits implies that the visitor has already visited.

An alternative approach would be in mySQL's end; if you are familiar with using table indexes, then you might already know that it's possible to make multiple fields into a single index. This would allow you to have... say a field in the table named "ip" and another called "date"; you could then make a UNIQUE index combining those two fields, which means mySQL won't insert the record again if there is already a record that has the combined ip/date index.

Use cookies or sessions. Just as a user visits the page, create a cookie with an expiry of one day. if the cookie exits implies that the visitor has already visited.

Hi thanks for the reply and I just wanna know about the real logic behind the visitor count. In which logic google and other ranking sites calculating our visitor count per day ...

Thanks
Rajeesh

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.