Time spent per page???

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
lacroix13
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Aug 22, 2002 1:07 am

Time spent per page???

Postby lacroix13 » Wed Sep 18, 2002 3:00 am

How can I make a script that for each page in a site writes in a database the time spent by a user per page? :evil:

DoppyNL

Postby DoppyNL » Wed Sep 18, 2002 6:15 am

You could enter the time in the database when the page was requested and again when the next page is requested in the same session.

However, that would leave you with the problem that a user can use 2 browser-windows for the same session.
Also, a user could be doing something completely different while the page is open, like having a cup of coffee in the next room, hmmm, good idea :P

the latter problem you will probably have with every solution.

It also comes to my mind how usefull the data would be since the data is very likely not to be accurate!! (see above reasons).

Greetz Daan

Jay

Postby Jay » Wed Sep 18, 2002 9:37 am

At the bottom of every page insert a script that'll insert the info into a database: time (obviously), page and the sessionID so you can identify individual users

User avatar
lacroix13
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Aug 22, 2002 1:07 am

Postby lacroix13 » Wed Sep 18, 2002 12:29 pm

Yes, I understand the general ideea but I dont know how to code that Jay. How can I find out the time spent from opening to closing that page? 8O And also, if the user signs out, how can i keep the session to log the time?Isn't it destroied?? 8O :?: :?:

Jay

Postby Jay » Wed Sep 18, 2002 2:19 pm

You can never track how long a person spends on a page, but you can take pretty good guesses (using masses of code and javascript which I won't go into). The only thing you can do is log at what time each page was requested, and work out how long was spent on that page by calculating the difference in time between that page being requested, and the next one!

User avatar
lacroix13
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Aug 22, 2002 1:07 am

Postby lacroix13 » Wed Sep 18, 2002 11:12 pm

OKYE DOKYE :D
Thanks :lol:


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

cron