Survey ends prematurely and crashes sometimes | XM Community
Skip to main content

We are collecting data for a study using custom js code. The code is supposed to end the survey whenever the participants take the full amount of time for a question three questions in a row. The code and survey flow seem to work fine when we test it in preview and published versions but in our two data collection session that we had so far, the survey seems to crash or end prematurely for our participants, even though they have not met the condition of taking the full amount of time (150 seconds) three times in a row (see attached file). Some participants make it further than others but the pattern seems to be rather random.
Any help or suggestions of making the survey more stable would be highly appreciated as we have more data collection sessions coming up soon.

Code:

Qualtrics.SurveyEngine.addOnReady(function()
{
var startHolder = new Date();
var auto = Qualtrics.SurveyEngine.getEmbeddedData('auto');

console.log(auto, "in a row")

Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var TimeDiff = new Date() - startHolder;
TimeDiff /= 1000;
console.log("Time diff:", TimeDiff)

if(TimeDiff < 150) {
auto = 0;
console.log("auto is:", auto);
Qualtrics.SurveyEngine.setEmbeddedData("auto", auto)
} else {auto = auto + 1; console.log("auto is:", auto);
Qualtrics.SurveyEngine.setEmbeddedData("auto", auto)}
});
});


image.png

phase1_qualtrics_support.xlsx

Be the first to reply!

Leave a Reply