Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

How can we get a page time at millisecond scale?

Hi:

I am doing a concept testing that require respondents quickly give out a like/dislike response at the first glance of a concept and we will use the page time as a measure of the concept discrimination.
And I found current lighthouse studio's page time is at second level but not millisecond level.
So I can think of to write some code in the JavaScript verification section and calculate the millisecond level page time....
Is there anyone can share some experience for this?

Thanks
asked Mar 2 by anonymous

1 Answer

0 votes
Try adding a free format question to the same page.  Give the free format a hidden variable named "_pagetime" and this HTML:

<input name="[% QuestionName() %]_pagetime" id="[% QuestionName() %]_pagetime" type="hidden" value=""/>
<input name="[% QuestionName() %]_starttime" id="[% QuestionName() %]_starttime" type="hidden" value=""/>

<style>
#[% QuestionName() %]_div {
    display: none;
}
</style>

<script>
$(document).ready(function(){
    var now = new Date();
    $('#[% QuestionName() %]_starttime').val(now.getTime());
});
</script>


Finally, give it this custom JavaScript verification to run before system verification:

var now = new Date();
var start = Number($('#[% QuestionName() %]_starttime').val());
var end = now.getTime();
var total = Number($('#[% QuestionName() %]_pagetime').val());
total += end - start;
$('#[% QuestionName() %]_pagetime').val(total);
answered Mar 4 by Zachary Platinum Sawtooth Software, Inc. (114,750 points)
Perfect, It works!!!
Thanks Zachary.
...