Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Timing Visits

  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Timing Visits

    I am trying to time the length of time each person views my website. I found a javascript script that will do this but I can't enter that into mysql database. Is there a way to do this with php?

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Well you can do it with sessions. You store the time when the session was created and store the time the user performed an action (requested a webpage). You then subtract one from another and that's it.
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #3
    Regular Coder goughy000's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    415
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you could also.. if your feeling like a bit more coding..

    set up a bit of ajax which querys the server every x seconds to say the user is still on the page

    the server side then subtracts the current time from the last time and adds this to a running total


    or something

    didnt put much thought into that so its probably quite badly thought out
    PHP Freelancing!
    ByteForums!
    Scriptlance.comNeed a job done quick? post it on scriptlance! OR! your a programmer? sign up and get paid for these jobs!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •