SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Visit Time

  1. #1
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,811
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I would like to somehow (possibly with the "onload" and "onunload" functions) discover how long individual visitors are spending at a site. Have a mySQL back end, so there is somewhere for the data to be sent...

    Any ideas?

    cheers, H

    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  2. #2
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pretty sure that isn't possible with JavaScript or similar - you can't send the data the java generates on the client to the MySQL backend on the server.
    You would need to use PHP or similar, although the best way would be to find a log analyzer that can work out the average time a visitor spends on your site directly from teh weblogs.

  3. #3
    SitePoint Evangelist
    Join Date
    Jul 2000
    Location
    Warwickshire, England
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it would be possible to use the onload and unload functions. The only way I can think of a way to get total time spent on the site and not on individual pages would be to have a hidden frame.
    The start time could be given by calling a JavaScript source file (like js.php), this could assign the user a unique value. When the user exits the site (and the frame closes), a "goodbye" popup could be displayed, after passing the time spent on the site to a php script. Like window.open (... "timer.php?total=" + totaltime + "&user=" + initialphpscriptgivenvalue + "&extrainfo=" + extrainfoaboutbrowseretc );

  4. #4
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,811
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hmmm - Have to give this one some thought. Thanks for the advice.

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS


Bookmarks

Posting Permissions

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