473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

logging time spent on my website

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
10 4709
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
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
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
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
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
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pete Jereb | last post by:
Ok, I've managed to get the logging package to work, sort of. I'm writing a text parser, where data entry clerks can edit large, unwieldy and unforgiving textfiles that are VERY SENSITIVE as to...
0
by: Neil Benn | last post by:
Hello, I'm running a test and having issues with logging, if I call logging.shutdown() and then want to start the logging going again then I get a problem as if I call shutdown, I can't get the...
1
by: Karthik | last post by:
Hi, I have a website running on ASP.Net on IIS 6.0. This website has more than 10000 users login everyday. At times the users login with the same user name and password more than once at the...
9
by: Jean-David Beyer | last post by:
When initially populating a database, it runs slower that I would have supposed. Checking here and there, especially with iostat, reveals that most of the time is spent writting the logfiles. In...
3
by: MotorcycleIke | last post by:
I tried using WebRequest, but I am unable to simply redirect to an external aspx site and supply the userid and password and press their login button. Can anyone help? Thanks, I've spent a...
2
by: MotorcycleIke | last post by:
I tried using WebRequest, but I am unable to simply redirect to an external aspx site and supply the userid and password and press their login button. I got the webrequest to populate a...
6
by: Jeff | last post by:
ASP.NET 2.0 In my webproject I want to implement some kind of functionality which logs the vistits to the website. I want it to log what pages the user requested, when he arrived at the website...
12
by: Eric S. Johansson | last post by:
I need to to be able to conditionally log based on the method the log statement is in and one other factor like a log level. in order to do so, I need to be able to automatically find out the name...
6
by: Larry Bates | last post by:
Every time I look at the logging module (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.