Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

215
Visualizações
(how) can I tell my JavaScript to append a variable/column to the data Qualtrics exports?

I've implemented a task in Qualtrics that randomly selects a number between 0 and 3, and then selects a corresponding word pool to sample 5 words from. To be able to analyze these data, though, I need to know which 5 words (or at minimum, the index number or name of the word pool being sampled from) is presented to each respondent. Is there a way to implement the recording of this information within JavaScript? Ideally this information would show up when I use Qualtrics' native "export" options, but if I have to somehow create a second spreadsheet with this treatment data, that works just fine as well.

Qualtrics.SurveyEngine.addOnload(function()

{

// first, create four arrays for the four word pools used in task

var wordpool1 = []

var wordpool2 = []

var wordpool3 = []

var wordpool4 = []

// assemble word list arrays into one array, with index 0-3

let masterwordlist = [wordpool1, wordpool2, wordpool3, wordpool4]

// function that randomly chooses an integer between x and y

function randomInteger(min, max) {

 return Math.floor(Math.random() * (max - min + 1)) + min;

}

// function that shuffles (randomizes) a word list array (Fisher-Yates shuffle )

    function shuffle(target){

      for (var i = target.length - 1; i > 0; i--){

        var j = Math.floor(Math.random() * (i + 1));

        var temp = target[i];

        target[i] = target[j];

        target[j] = temp;

      }

      return target;

    }

// function that chooses 5 words from a shuffled word list array, returns those 5 words as array

function pickWords(target) {

var randomwords = shuffle(target)

 return randomwords.slice(0, 5);

}

// top-level function 

function genWords(masterlist){

var x = randomInteger(0, 3)

return pickWords(masterlist[x])

}

// actually running the function

randomwords = genWords(masterwordlist)

// save final output as embedded qualtrics data

Qualtrics.SurveyEngine.setEmbeddedData("randomwords", randomwords);

Is there a way I can have this code record (within Qualtrics or otherwise) which values var x or var randomwords take on?

EDIT: I found another answer on here which may be relevant. According to this answer, though, it looks like I have all the code needed to record my variable selection; do I simply need to set embedded data within the survey flow, as well? See here: Is it possible to save a variable from javascript to the qualtrics dataset?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes, you need to define the embedded data field randomwords in the survey flow.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda