I want to calculate the duration of a block that has multiple pages. For example, one block has 23 questions. Each question shown on a different page. I want to know how long it takes for respondents to get through the block. I do not need for the timer to be visible to participants.
Here's what I have tried:
At the beginning of the block, I capture the time upon load in a hidden question (note: I use hidden questions because of randomization so that I can just randomize all other questions in the block, except for the first and last ones capturing the start and end times):
Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("#"+this.questionId).hide();
var startTime = new Date();
Qualtrics.SurveyEngine.setEmbeddedData( 'startTime', startTime);
this.clickNextButton();
});
At the end of the block, I capture the time again in a hidden question:
Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("#"+this.questionId).hide();
var endTime = new Date();
Qualtrics.SurveyEngine.setEmbeddedData( 'endTime', endTime);
this.clickNextButton();
});
In the next block, I want to calculate the duration and display to the respondent. I have tried using JS with the variables above and with the embedded data, like this:
Qualtrics.SurveyEngine.addOnload(function()
{
var duration = (endTime.getTime() - startTime.getTime()) / 1000;
Qualtrics.SurveyEngine.setEmbeddedData( 'duration', duration);
});
and
Qualtrics.SurveyEngine.addOnload(function()
{
var duration = ("${e://Field/endTime}".getTime() - "${e://Field/startTime}".getTime()) / 1000;
Qualtrics.SurveyEngine.setEmbeddedData( 'duration', duration);
});
I have even just tried doing a Qualtrics equation $e{ ( e://Field/endTime - e://Field/startTime ) / 1000 }. But it's not working, any help? I'm open to trying a completely different method altogether, too.
Thanks,
Josh
Duration of a block with multiple pages
Best answer by TomG
In the survey flow before the block:
start = ${e://Field/Q_TotalDuration}
In the survey flow after the block:
duration = $e{ e://Field/Q_TotalDuration - e://Field/start }
To display the duration in the next block, pipe duration:
${e://Field/duration}
No JS or hidden questions needed.
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
