Closed Thread
Results 1 to 9 of 9




  

Thread: How to get the timespan a visitor stays on site before bouncing away?

      
  1. #1
    Jedi Master yangyang is on a distinguished road yangyang's Avatar
    Join Date
    April 27, 2008
    Posts
    75
    Rep Power
    5
    Feedback Score
    0

    Default How to get the timespan a visitor stays on site before bouncing away?

    Trying to build a cute little php site statistics script, now I'm stuck with getting the average visiting time on site.

    How to do that? I'm using JS badge.

    HTTP is stateless, if that is the case how the server knows when the visitor navigates away? JS onunload?
    Scraped databases as quick content solutions for your websites.
    We are blogging at Kavoir. You may also be interested in this economics blog. :Icky:

  2. #2
    Grand Masters GameOver is a jewel in the roughGameOver is a jewel in the roughGameOver is a jewel in the roughGameOver is a jewel in the roughGameOver is a jewel in the roughGameOver is a jewel in the roughGameOver is a jewel in the rough
    Join Date
    April 27, 2008
    Location
    Australia
    Posts
    626
    Rep Power
    5
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    Just use google analytics, its free

  3. #3
    Grand Masters Colleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond reputeColleen has a reputation beyond repute Colleen's Avatar
    Join Date
    September 22, 2006
    Location
    Canada
    Posts
    11,144
    Rep Power
    26
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    Quote Originally Posted by GameOver View Post
    Just use google analytics, its free
    I am sure he's building and wanting to use his own script for a reason.

    yangyang, I'm not a programmer so I don't know, I am not sure there's any programmers here to help but hopefully there is.

  4. #4
    Jedi Master joseph will become famous soon enoughjoseph will become famous soon enoughjoseph will become famous soon enough joseph's Avatar
    Join Date
    January 28, 2007
    Location
    here and there
    Posts
    233
    Rep Power
    6
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    I'm no coder either, but this might point you in the right direction:
    999 Tutorials - Show time spent on a site when they leave

  5. #5
    Jedi Master yangyang is on a distinguished road yangyang's Avatar
    Join Date
    April 27, 2008
    Posts
    75
    Rep Power
    5
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    I'm no coder either, but this might point you in the right direction:
    999 Tutorials - Show time spent on a site when they leave
    Helps. Thanks.

    The apache access logs can be analyzed for average on-site time, how does the stats program do that? e.g. weblog expert.
    Scraped databases as quick content solutions for your websites.
    We are blogging at Kavoir. You may also be interested in this economics blog. :Icky:

  6. #6
    I'm New! o0DarkEvil0o is on a distinguished road
    Join Date
    May 14, 2008
    Posts
    7
    Rep Power
    0
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    This way may help you on php
    1. Make img.php with param opt:
    opt=[0, 1] <=> [visited, leaved];
    variable:
    if($_SESSION['visited']=='') $_SESSION['visited']=time();
    $opt=$_REQUEST['opt'];
    $IP=$_SERVER['REMOTE_ADDR'];
    [/QUOTE][/QUOTE] store 3 var abow to table state(ip, loggedtime, opt)
    2. make cron.php run cron each 1 minute to do.
    each $IP
    if($opt==1 && (time()-lastcheck)>60))
    {
    make a row in table logging(ip, onlinetime, loggedtime)
    del row with that ip
    }
    3. in each page of site insertcode
    <body onload="return ols(0)" onunload="return ols(1)">
    4. JS Code
    funciton ols(id)
    {
    imgs=new Image();
    imgs.src="your_link_site/yourpath/img.php?opt="+id;
    return true;
    }
    make yourseft code and check for free

  7. #7
    I'm New! vpsville is on a distinguished road vpsville's Avatar
    Join Date
    May 22, 2008
    Posts
    16
    Rep Power
    5
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    There is no way. The users browser does not send anything to a site its leaving.

    The only thing you can do is use a third party like google analytics which will know when the user has gone to another site, if they also use analytics. Its also free.

  8. #8
    Grand Masters benjaminp is just really nicebenjaminp is just really nicebenjaminp is just really nicebenjaminp is just really nicebenjaminp is just really nicebenjaminp is just really nicebenjaminp is just really nicebenjaminp is just really nice benjaminp's Avatar
    Join Date
    April 4, 2008
    Posts
    1,102
    Rep Power
    5
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    Quote Originally Posted by vpsville View Post
    There is no way. The users browser does not send anything to a site its leaving.

    The only thing you can do is use a third party like google analytics which will know when the user has gone to another site, if they also use analytics. Its also free.
    Why can google do the impossible then? There must be a way to do it. I'm assuming it is something to do with JS, but I am no coder (html and basic php ).
    Tech Blog | Film Trailers

    Join GamesHuddle! The greatest gaming forum on the net.

  9. #9
    I'm New! o0DarkEvil0o is on a distinguished road
    Join Date
    May 14, 2008
    Posts
    7
    Rep Power
    0
    Feedback Score
    0

    Default Re: How to get the timespan a visitor stays on site before bouncing away?

    Quote Originally Posted by vpsville View Post
    There is no way. The users browser does not send anything to a site its leaving.

    The only thing you can do is use a third party like google analytics which will know when the user has gone to another site, if they also use analytics. Its also free.
    Did you check google search code?
    If you did, you can find that: my code is possible.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Tiger Kills visitor at San Francisco Zoo
    By Stax in forum World News
    Replies: 49
    Last Post: Jan 3rd, 2008, 11:02 am

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
WebTalkForums
WebTalkForums
Recent Forum Threads