1

I've got very thinkable problem and need help of which is the best way I should follow

Note

I'm talking about 10K hits/day

Missions

  1. Not using too much of my hosting server resources
  2. Not getting my site slow loading

Problem

I have a website that would give a point upon each unique visitor came.

  • If that visitor came again in less than 12 hours since his last visit then he would not counted.
  • If that visitor came again after 12 hours, he would be counted as a new visit and will get one more point.

Now,

There are many methods to do this but it looks like they are not good enough for websites with huge traffic.

If i record IP and time in database of every visit and if that visitor came again then i'll compare it by ip and time. To know if it was a new visitor of a new ip or an old one who came within 12 hours or after 12 hours.

That may take time and slow the whole website down.

So any idea or strategy how to do this ?

I've been thinking about Tracking unique visitors of the best answer of Glenn Nelson but in my case i need to recount the visitor as unique every 12 hours.

Community
  • 1
  • 1
Reham Fahmy
  • 4,937
  • 15
  • 50
  • 71
  • How are you recording the user visit in the database? Do you have index on the appropriate columns (IP and visited time)? – Srinivas Jan 01 '13 at 09:18
  • Have you considered using [Google analytics](http://www.google.ca/analytics/)? They provide very powerful tracking data. – Supericy Jan 01 '13 at 09:20
  • @Srinivas , I've been thinking to get the visitor ip and visit time then save it in db table and if that visitor came again will get its ip and compare it within that stored in db if new then count as UV if not then will check if its last visit time was passed over 12 hours then will counted as UV and will update its visit time but if not then he is not UV >>> BUT this may makes my site so slow if getting a lot of traffics. – Reham Fahmy Jan 01 '13 at 09:23
  • @Supericy my question in fact is simple case but if i found good solution, i'll apply it for my website where visitor register then create links and gets point upon UVs of their links so google analytics won't help me cause i'm not only needs to know my website statics. – Reham Fahmy Jan 01 '13 at 09:26
  • @Jack Ben: I can't tell if you're asking about running reports or if this data is used in a function of each page hit. Running reports are completely separate from the operation of your website. Even executing an expensive query once in a while on your db to run some numbers really shouldn't impact your website at all. – bob-the-destroyer Jan 01 '13 at 09:41
  • @bob-the-destroyer this is for simplicity i'm talking about whole website report of unique visitors with expiration time to recount but if i found good solution i will modify it by add "ID" of each page and so on so i can apply it in a function of each page hit on my website. a good example for this is adfly dot com , they can monitor each link UVs and count it again if the same visitor visit the same link after 24 hours. – Reham Fahmy Jan 01 '13 at 09:47

1 Answers1

0

Have you thought about using cookies? You might use:

set cookie expire time for 12 hrs.
    if cookie_expired
        give more points
    else
        renew cookie

Just a simple idea, I am not totally sure if it is quicker but assuming that you have users you'll need a cookie anyway.

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Alex Spencer
  • 834
  • 2
  • 12
  • 23
  • looks good and simple but i'm not sure if cookies would be the best solution or not ~ Thanks for your suggestion – Reham Fahmy Jan 01 '13 at 09:29