Timing question with higher accuracy | XM Community
Skip to main content

Hello,
I'm trying to measure a time for the question that contains two scales on the same page.
I need to keep the two scales on the same page. Also, I am not forcing the participants to answer the questions.
My question is there any way that can help me to measure the time response for each scale separately?
Moreover, Some people noticed that there is a specific code we can add to the timing question to measure more accurately.
Any help or recommendations is highly appreciated!
Aysheh

This jQuery might help
// Declare variables for the start and end times
var startTime1, endTime1, startTime2, endTime2;

// Start timer for Scale 1 when the page loads
$(document).ready(function(){
startTime1 = new Date();
});

// Stop timer for Scale 1 when the user clicks the next button
$("#NextButton").click(function(){
endTime1 = new Date();
// Calculate the time spent on Scale 1
var timeSpent1 = endTime1 - startTime1;
// Store the time spent on Scale 1 in a custom variable
Qualtrics.SurveyEngine.setEmbeddedData("time_scale1", timeSpent1);
// Start timer for Scale 2
startTime2 = new Date();
});

// Stop timer for Scale 2 when the user clicks the next button
$("#NextButton").click(function(){
endTime2 = new Date();
// Calculate the time spent on Scale 2
var timeSpent2 = endTime2 - startTime2;
// Store the time spent on Scale 2 in a custom variable
Qualtrics.SurveyEngine.setEmbeddedData("time_scale2", timeSpent2);
});


Leave a Reply