Jump to content

Measuring time on a page


yoda69

Recommended Posts

There is no active connection between the server and the client with php.

 

All you can do is Guesstimate - Set a timestamp for the current page the user requested, once the user changes/;requests a new page, reset the timer. Though once the user leaves the last page would be a long time so the last page is the most inaccurate.

 

Even though you cant really tell how long someone is looking at a page (which is more releveant than being on a page and not looking).

 

Basically you can get estimatesd but never a relevant exact accurate number.

 

-CB-

Link to comment
Share on other sites

And as i said, unless you have some extremely sophisticated webcam recognition software that could magically tell between different people, you just cant do it accurately. You will only get a guide, and the easiest guide is an average of time spent on all your pages. By tall ying up the times between page requests.

 

-CB-

Link to comment
Share on other sites

You could save the current time on the form page and then save the time when submitted and compare the two?

And what if someone navigates away from the page and then return a few days later?

 

Well his actual question was to see when a submit button was pressed after the page had been loaded. So a timestamp easily takes care of this problem with no issues.

 

1) Page loads

2) Timestamp is set

3) User clicks submit button

4) Submission code executes + 2nd timestamp is set

 

fail safe ;)

Link to comment
Share on other sites

Yeah, basically its exactly what I need. I'm running a psychological experiment so I need to find out how long a certain page with a specific psychological question was viewed and answered. The user is not supposed to go back to that page.

Link to comment
Share on other sites

Yeah if you want to be really accurate use microtime() (it gives an array, just add both together.)

 

If it is a test, then it wil be by someone willing/interested - So you can assume most will follow your rules (not going back for ex.).

But, they will cheat etc, but if its like an iq test it doesnt matter if they cheat, cuz if they arent honest it will be false anyway.

 

I reccommend testing it yourself, and doing everything you can think of to it, then put it up on the website security check forum (or w/e), get people to tell you what they find is wrong.

 

o btw - it helps if the topic is marked as solved. Cheers.

 

-cb-

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.