Time tracking for open answers with more than one field | XM Community
Skip to main content

Is it possible to track the time a participant needed to answer open comments with more than one line. For example there are 10 fields to answer openly, would it be possible to check how much time the participant needed for each of those 10 answers individually?

Hi CaroZ ,
I hope this helps, just update the code for number of text fields(in eq()) according to your requirement, the below code is for first 2 text fields. Make sure that you create the embedded variables (firstField, secondField etc..) above this question in the survey flow.
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/

//first field

jQuery('input[type="text"]').eq(0).keyup(function(){
starttime1 = new Date().getTime();
});

//second field

jQuery('input[type="text"]').eq(1).keyup(function(){
starttime2 = new Date().getTime();
});

});


Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

//First field
endtime1 = new Date().getTime();
timeSpent1 = Math.floor((endtime1 - starttime1)/1000);
Qualtrics.SurveyEngine.setEmbeddedData("firstField",timeSpent1);

//Second field

endtime2 = new Date().getTime();
timeSpent2 = Math.floor((endtime2 - starttime2)/1000);
Qualtrics.SurveyEngine.setEmbeddedData("secondField",timeSpent2);
});


Leave a Reply