How to calculate unique views for a page

Discussion in 'PHP' started by vinoth.t, Dec 24, 2009.

  1. #1
    Hi,
    I want to count the unique views for a page. I complete most of the part. Now my problem is it should not consider any robots, spammer. Because It should be count only users not any other crawling. How can I do it.
     
    vinoth.t, Dec 24, 2009 IP
  2. xenon2010

    xenon2010 Peon

    Messages:
    237
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can get user agents of bots and exclude them..
    and what do you mean by spammers?
    you cannot detect spammers its impossible :D
     
    xenon2010, Dec 24, 2009 IP
  3. vinoth.t

    vinoth.t Peon

    Messages:
    156
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Because user-agent can be set by program also. Now I'm trying to get OS name will this correct
     
    vinoth.t, Dec 24, 2009 IP
  4. xenon2010

    xenon2010 Peon

    Messages:
    237
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    and spammers don't use OS to send their stuff?
    mate you are asking somthing impossible to do..
    all you can do is to record unique IPs then exclude bots IPs from the list.. that's it.
     
    xenon2010, Dec 25, 2009 IP
  5. CyberJ37

    CyberJ37 Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Have a script insert the IP of the visitor into a table, but checks if it already exists before inserting.

    Of you could just store all IPs and "SELECT DISTINCT"
     
    CyberJ37, Dec 27, 2009 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    Or just use a strong service like google analytics..
     
    Bohra, Dec 27, 2009 IP
  7. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #7
    You could insert all unique IP's into a table. So before insertion, just check the database to see if the IP has already been inserted, and then to display use

    SELECT * FROM ip

    and then use mysql_num_rows() to count the number of IP's that you have in the table
     
    Grit., Dec 27, 2009 IP
  8. Izonedig

    Izonedig Member

    Messages:
    150
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #8
    Yes, all you can do is saving unique IPs in your database, then delete bots ip :)
    About spammers, the only way I think you can use, is to check how many pages he oppens in some very little time.
    What I mean is that if the spammer opens 10 in 2 sec (using a script for example), you can get it. BUt if he opens only one page you will never get it :(
     
    Izonedig, Dec 29, 2009 IP