Saving image number/field in output | XM Community
Skip to main content

Hello,
Thanks for all the help received so far. I'm presenting randomly using loop and merge 32 images. They are the same images presented 4 times. I am using java script to record the order of the images, however as they are the same images presented 4 times I need to also record the image number. I've tried to add embedded data to the survey flow and using JavaScript to saving both imageNumber but also a field2 (from the loop and merge) which contains image number but neither of this actually prints anything in the output file. The imageOrder is saving in the output file but not the sequenceOrder (although there is a header for it). Any help would be greatly appreciated.
Polly
Qualtrics.SurveyEngine.addOnload(function()
//bunch of other JS

//save the URL of the image in the array that records their randomized Loop & Merge order
imageOrder[imageNumber] = "${lm://Field/1}"

//turn on mousetracking - has to be done now instead of being triggered by first move because otherwise first move wouldn't be recorded
document.addEventListener("mousemove", getMousePosition)

//save the URL of the image in the array that records their randomized Loop & Merge order
sequenceOrder[imageNumber] = "${lm://Field/2}"
});//end of addOnload function
Qualtrics.SurveyEngine.addOnReady(function()
{//begin: addOnReady function
//bunch of JS
});// end: addOnReady function



Qualtrics.SurveyEngine.addOnPageSubmit(function(type)
//everything in this function is executed when Next button is clicked
{//bunch of other JS
console.log("readyTime array for image #: "+ imageNumber +": "+readyTime.join("a")) //This seems to have to be here for the following data to be saved???!!!
Qualtrics.SurveyEngine.setEmbeddedData("stimulusOrder", imageOrder.join("|"))
Qualtrics.SurveyEngine.setEmbeddedData("sequenceOrder", sequenceOrder.join("|"))
} // end: if Next button block
}); //end: addOnPageSubmit function

Be the first to reply!

Leave a Reply