Hi,
I carry out a study in which I present different sentences (one per page). I inserted a first name randomly in each sentence.
I created one descriptive text question and add this code in Javascript (thanks to the contributor who helped me!).
Qualtrics.SurveyEngine.addOnReady(function()
{
var names = ["Jennifer", "Jessica", "Amanda", "Ashley", "Sarah", "Stephanie", "Melissa", "Nicole"];
var copy = names.slice();
var cnt=1;
while( copy.length )
{
var name = copy.splice( Math.floor(Math.random()*copy.length), 1 );
console.log(name)
Qualtrics.SurveyEngine.addEmbeddedData("name"+cnt, name);
cnt+=1
}
jQuery('#Wrapper').css('visibility','hidden');
jQuery('#Wrapper').css('opacity','0');
jQuery('#NextButton').click();
});
My problem is that i have to recorder the order that was presented to each participant. How can I do that ?
Ideally, the order should be recorded in the response data.
Thank you very much for your help and have a good day !
Solved
Embedded data, randomization and Javascript : How to record the presentation order each time ?
Best answer by rondev
Create an embedded data "NameOrder" and update the code as below:
Qualtrics.SurveyEngine.addOnReady(function()
{
var names = ["Jennifer", "Jessica", "Amanda", "Ashley", "Sarah", "Stephanie", "Melissa", "Nicole"];
var copy = names.slice();
var cnt=1;
var arr = [];
while( copy.length )
{
var name = copy.splice( Math.floor(Math.random()*copy.length), 1 );
console.log(name)
Qualtrics.SurveyEngine.addEmbeddedData("name"+cnt, name);
arr.push(name);
cnt+=1
}
Qualtrics.SurveyEngine.addEmbeddedData("NameOrder", arr.toString());
jQuery('#Wrapper').css('visibility','hidden');
jQuery('#Wrapper').css('opacity','0');
jQuery('#NextButton').click();
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
