Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How to get the timespan a visitor stays on site before bouncing away?
Old 04-29-2008, 06:06 AM How to get the timespan a visitor stays on site before bouncing away?
Banned

Posts: 81
Location: kavoir.com
Trades: 0
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?
yangyang is offline
Reply With Quote
View Public Profile Visit yangyang's homepage!
 
 
Register now for full access!
Old 04-29-2008, 10:08 AM Re: How to get the timespan a visitor stays on site before bouncing away?
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
If you're going to do it with JavaScript then yep, onunload or onbeforeunload would definitely be one way to do it. Just keep in mind that not all of your users will have JavaScript enabled.

I'd use that in conjunction with sessions with the assumption that many of the people who visit your site will be navigating to another page on your site.

If you're tracking this in a database, for any open table rows you have that the page view time is ridiculous, you could just place a marker on it, and when you run your stats either throw it out, or assume the time spent on that page is the same as your calculated average for that page. Just a thought
__________________
Chris Duerr
AddonChat Java Chat Software

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Old 04-29-2008, 12:11 PM Re: How to get the timespan a visitor stays on site before bouncing away?
Banned

Posts: 81
Location: kavoir.com
Trades: 0
Thanks for the heads-up. Now I wonder how most of the site statistics / logs analyzers do that.
yangyang is offline
Reply With Quote
View Public Profile Visit yangyang's homepage!
 
Old 04-29-2008, 12:22 PM Re: How to get the timespan a visitor stays on site before bouncing away?
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
With respect to time spent viewing a page -- not very well.

You said it, HTTP is a stateless protocol. I have no clue if a customer of mine sat and read a web page for six hours, or loaded it and left the room for a smoke.

With respect to marketing analysis, I (personally, not saying it may not be important for you or others) have no use for that data. I care more about what pages are viewed, where the user was previously at, and where the user went to. I just want to know correlations; primarily so I can find out what I need to do better to make a sale.

Google Analytics is very good in this respect -- maybe they've got a page up there (hopefully that doesn't involve pigeons) explaining how their system works.
__________________
Chris Duerr
AddonChat Java Chat Software

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to get the timespan a visitor stays on site before bouncing away?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13180 seconds with 12 queries