[advanced search]
NamePros Domain Auction
Live Event This Thursday at 6PM EDT - Prebidding open now
12 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 04-29-2008, 02:06 AM   · #1
ichsie
NamePros Member
 
ichsie's Avatar
 
Trader Rating: (2)
Join Date: Mar 2007
Posts: 56
NP$: 0.00 (Donate)
ichsie will become famous soon enoughichsie will become famous soon enough
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?


Please register or log-in into NamePros to hide ads
__________________
Challenges are our daily athletics, we love your projects as they are our own children. Rely on us for any front end web development and web design projects. Feel free to request a quote.
ichsie is offline   Reply With Quote
Old 04-29-2008, 03:05 AM   · #2
maximum
MyDomains.net
 
maximum's Avatar
 
Name: -Unknown-
Location: Inside your head...
Trader Rating: (15)
Join Date: Oct 2005
Posts: 807
NP$: 45.70 (Donate)
maximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud of
Child Abuse Special Olympics Save a Life Baby Health Autism
A script that marks the start-time for that IP#, then an "onunload" posting to it to mark the "leaving-time" is probably your only real viable option. While others may think of another way (if so, please educate me ), that (an onunload event) is the only solution outside Ajax that I can think of. With Ajax, you could continually call a timer from a PHP script. The problem with doing that is that you would want (to get a good "average") to have it call the time atleast every second, and the bandwidth will end up killing you if you used this Ajax method

Possibly a combo of the two: calling the PHP script on "onload", then again on "onunload", both via Ajax, might do the trick for you
__________________
In loving memory of my mother - Valettajho - Sept. 23, 2008
A devoted mother, sister, grandmother, great-granddaughter, and a true friend to anyone blessed enough to have met you. You taught me well, and made me who I am today. I can only hope to live the remainder of my life in a fashion that you would be proud of. Your life may have been taken by the hands of a man, but in doing so he delivered you into the hands of God. You will forever be missed.
maximum is offline  
  Reply With Quote
Reply

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Proof is in the Parking free webhosting Traffic Down Under
Advertise your business at NamePros
All times are GMT -7. The time now is 07:05 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0