By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

logging time spent on my website

P: n/a
Hi guys,
Im about to build a script which will log visitor time spent on my website.
I got a few ideas about this, maybe checking visitors ip and storing that
info in db with time in and then using session vars to check time out ...

Anyone has any ideas about doing that kind of script?

Thank you!
--
Yang
Jul 17 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
IP tracking is not a good way, especialy when it comes to AOL users.

general theory is you update a time stamp, and when the time stamp is older
than a predeterimed time, then it is assumed they have left.

when you update time stamp, you could also, calc the differnce between
timestamps, to get an idea of how long they were there.

again, assume they left if diff becomes too great

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Yang Li Ke" <ya******@sympatico.ca> wrote in message
news:Oh*******************@news20.bellglobal.com.. .
Hi guys,
Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that
info in db with time in and then using session vars to check time out ...

Anyone has any ideas about doing that kind of script?

Thank you!
--
Yang

Jul 17 '05 #2

P: n/a
ok but to update that timestamp in a mysql db right?
I need to open up a endless while() on the page or
you have other ideas?

Thanx Count, I know I could count on you ;)
--
Yang
"CountScubula" <me@scantek.hotmail.com> wrote in message
news:cG******************@newssvr29.news.prodigy.c om...
IP tracking is not a good way, especialy when it comes to AOL users.

general theory is you update a time stamp, and when the time stamp is older than a predeterimed time, then it is assumed they have left.

when you update time stamp, you could also, calc the differnce between
timestamps, to get an idea of how long they were there.

again, assume they left if diff becomes too great

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Yang Li Ke" <ya******@sympatico.ca> wrote in message
news:Oh*******************@news20.bellglobal.com.. .
Hi guys,
Im about to build a script which will log visitor time spent on my

website.
I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then using session vars to check time out ....
Anyone has any ideas about doing that kind of script?

Thank you!
--
Yang


Jul 17 '05 #3

P: n/a
include a script at the begining of all your pages, or in your main include
script do another include.

then in this script you do this:

update via session or db or flat file, its up to you,
get the timestamp from file/db/session subtract the diff from last time to
this time, an store that as the time on site.
then store current time stamp

you now have 2 items, last length of time, and current time stamp.

thats it, do not do an endless while loop!

then on someother page or stats tracking thing you have going on, loop
through the data, and look at all
the lengths of time.
--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Yang Li Ke" <ya******@sympatico.ca> wrote in message
news:7q*******************@news20.bellglobal.com.. .
ok but to update that timestamp in a mysql db right?
I need to open up a endless while() on the page or
you have other ideas?

Thanx Count, I know I could count on you ;)
--
Yang
"CountScubula" <me@scantek.hotmail.com> wrote in message
news:cG******************@newssvr29.news.prodigy.c om...
IP tracking is not a good way, especialy when it comes to AOL users.

general theory is you update a time stamp, and when the time stamp is

older
than a predeterimed time, then it is assumed they have left.

when you update time stamp, you could also, calc the differnce between
timestamps, to get an idea of how long they were there.

again, assume they left if diff becomes too great

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Yang Li Ke" <ya******@sympatico.ca> wrote in message
news:Oh*******************@news20.bellglobal.com.. .
Hi guys,
Im about to build a script which will log visitor time spent on my

website.
I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then using session vars to check time out ...
Anyone has any ideas about doing that kind of script?

Thank you!
--
Yang



Jul 17 '05 #4

P: n/a
Yang Li Ke wrote:
Hi guys,
Im about to build a script which will log visitor time spent on my website.
I got a few ideas about this, maybe checking visitors ip and storing that
info in db with time in and then using session vars to check time out ...

Anyone has any ideas about doing that kind of script?

Thank you!


Try this:

http://devarticles.com/c/a/PHP/Makin...istics-in-PHP/

Jul 17 '05 #5

P: n/a
Ok I know what you mean but for example the visitor comes in my main page.
I store the timestamp in db ok thats cool. Then he stays there read the
content
without clicking on a link or changing page. Then he leaves the page and
goes
to another site or close his browser. That way I only have the time he came
in
and not the time he left. Thats why I was thinking of a endless loop.

Thank you
--
Yang
"CountScubula" <me@scantek.hotmail.com> wrote in message
news:Gu******************@newssvr29.news.prodigy.c om...
include a script at the begining of all your pages, or in your main include script do another include.

then in this script you do this:

update via session or db or flat file, its up to you,
get the timestamp from file/db/session subtract the diff from last time to
this time, an store that as the time on site.
then store current time stamp

you now have 2 items, last length of time, and current time stamp.

thats it, do not do an endless while loop!

then on someother page or stats tracking thing you have going on, loop
through the data, and look at all
the lengths of time.
--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Yang Li Ke" <ya******@sympatico.ca> wrote in message
news:7q*******************@news20.bellglobal.com.. .
ok but to update that timestamp in a mysql db right?
I need to open up a endless while() on the page or
you have other ideas?

Thanx Count, I know I could count on you ;)
--
Yang
"CountScubula" <me@scantek.hotmail.com> wrote in message
news:cG******************@newssvr29.news.prodigy.c om...
IP tracking is not a good way, especialy when it comes to AOL users.

general theory is you update a time stamp, and when the time stamp is

older
than a predeterimed time, then it is assumed they have left.

when you update time stamp, you could also, calc the differnce between
timestamps, to get an idea of how long they were there.

again, assume they left if diff becomes too great

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Yang Li Ke" <ya******@sympatico.ca> wrote in message
news:Oh*******************@news20.bellglobal.com.. .
> Hi guys,
> Im about to build a script which will log visitor time spent on my
website.
> I got a few ideas about this, maybe checking visitors ip and storing

that
> info in db with time in and then using session vars to check time
out ...
>
> Anyone has any ideas about doing that kind of script?
>
> Thank you!
> --
> Yang
>
>



Jul 17 '05 #6

P: n/a
On Wed, 18 Feb 2004 22:43:35 -0500, "Yang Li Ke"
<ya******@sympatico.ca> brought forth from the murky depths:
Hi guys,
Im about to build a script which will log visitor time spent on my website.
I got a few ideas about this, maybe checking visitors ip and storing that
info in db with time in and then using session vars to check time out ...

Anyone has any ideas about doing that kind of script?


I once set up pphlogger for a client. Its nice.
http://www.phpee.com/ freeware/donate
---=====---
After all else fails, read the instructions.
---=====---
Website Design and Update http://www.diversify.com
Jul 17 '05 #7

P: n/a
Yang Li Ke wrote:
Im about to build a script which will log visitor time spent on my website.


What does "on my website" mean?

--
Jock
Jul 17 '05 #8

P: n/a
John Dunlop wrote:

Yang Li Ke wrote:
Im about to build a script which will log visitor time spent on my website.


What does "on my website" mean?

Almost nothing reflecting reality. It's one of the most useless
datapoints around, as it doesn't meant anything much at all.

Brian Rodenborn
Jul 17 '05 #9

P: n/a
Yang Li Ke wrote:

Im about to build a script which will log visitor time spent on
my website.


No, you aren't: HTTP is a stateless protocol. Anyone who claims to know
how long a visitor looked at your web site is (at best) speaking from
ignorance.

You should read the readme for Analog, "How the web works":
http://www.analog.cx/docs/webworks.html

bblackmoor
2004-02-20
Jul 17 '05 #10

P: n/a
"Yang Li Ke" <ya******@sympatico.ca> wrote in message
news:ci*******************@news20.bellglobal.com.. .
Ok I know what you mean but for example the visitor comes in my main page.
I store the timestamp in db ok thats cool. Then he stays there read the
content
without clicking on a link or changing page. Then he leaves the page and
goes
to another site or close his browser. That way I only have the time he came in
and not the time he left. Thats why I was thinking of a endless loop.

Thank you
--
Yang


Ok, gotcha, I know what you want, what about something like this:
http://www-2.gzentools.com/test/time.php

There is no endless loop, but rather a piece of java that refreshes an
image, you can have a static image, this is served via a script, and the
script can update a counter thus update interval * count = time spent on
site/page

source:
http://www-2.gzentools.com/snippetvi...pts&v=time.php

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.