PHP

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • page duration tracking

    3 answers - 831 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Is there a way to incorporate some type of time in a page to track the
    duration of time each individual visitor spent on a specific page with PHP?
    I know I can keep a counter with JavaScript, but I would like it to keep
    track in my stats file.
    I can track & log the arrival time, but would like to either track the page
    exit time, too. It would be great to convert it to minutes:seconds for time
    spent viewing the page.
    I only want to track how much time someone spends on my index.php page
    before they leave the page. I can track when they click to the next page in
    my site.
    Thanks for any help and suggestions!
    Mike Lewitz
    Phoenix, AZ
    Supra - the only way to FLY!
    "Manage your destiny, or someone else will."
    ~Jack Welch, Former CE, General Electric
  • No.1 | | 1057 bytes | |

    MikeL said the following on 11/30/2005 11:39 AM:
    Is there a way to incorporate some type of time in a page to track the
    duration of time each individual visitor spent on a specific page with PHP?

    I know I can keep a counter with JavaScript, but I would like it to keep
    track in my stats file.

    I can track & log the arrival time, but would like to either track the page
    exit time, too. It would be great to convert it to minutes:seconds for time
    spent viewing the page.

    I only want to track how much time someone spends on my index.php page
    before they leave the page. I can track when they click to the next page in
    my site.

    You can only track the amount of time between page/file loads within
    your own site. Record the time when a page loads and then when the
    person loads another page on your site you can compare the times to
    figure out how long they were on the previous page.

    There is no reliable way to record if they leave your stie for another
    site or close their browser.
    - Ben
  • No.2 | | 965 bytes | |

    11/30/05, MikeL <Mailme1 (AT) 57mgte (DOT) comwrote:
    Is there a way to incorporate some type of time in a page to track the
    duration of time each individual visitor spent on a specific page with PHP?

    I know I can keep a counter with JavaScript, but I would like it to keep
    track in my stats file.

    I can track & log the arrival time, but would like to either track the page
    exit time, too. It would be great to convert it to minutes:seconds for time
    spent viewing the page.

    I only want to track how much time someone spends on my index.php page
    before they leave the page. I can track when they click to the next page in
    my site.
    --
    Thanks for any help and suggestions!

    Theoretically you should be able to use a javascript function in the
    page unload to submit back to your server when somebody navigates away
    from your page. Not sure if it would work 100% of the time but its
    worth a try.
    -Mike
  • No.3 | | 785 bytes | |

    Hello.

    J F wrote:
    I think you could use cookies for this.
    When the user loads the page you can write a cookie with the timestamp
    and the page loaded writen on it. Then when the user request another
    page, load if the cookie exists and then you can calculate the time
    spent on a certain page

    If I click two links within 1 second from the home page, the result
    won't be what you were expecting, unless you also take into account the
    HTTP-REFERER, but Is It a worthwhile task to be storing both
    timestamp and HTTP-REFERER for each loaded web page? I don't think so.

    So, If I must track the duration of time each individual visitor spent
    on a specific web page, I'd use the javascript method that Mike mentioned.

    Cheers.

Re: page duration tracking


max 4000 letters.
Your nickname that display:
In order to stop the spam: 5 + 4 =
QUESTION ON "PHP"

EMSDN.COM