Continuous Enjoyment Measure | XM Community
Solved

Continuous Enjoyment Measure

  • 26 November 2018
  • 6 replies
  • 63 views

Hello,
I'm a complete JavaScript newbie, but I've been relying on this forum for help for years! I've think I've finally stumbled across a question you have not answered.

I want to create a continuous measure of enjoyment using a slider. Survey takers will watch a video and continuously move a slider to tell me how much they are enjoying the video in the moment. Is there any way to continuously capture how the participant move the slider?

Thanks for your help!

Holly
icon

Best answer by TomG 26 November 2018, 23:16

View original

6 replies

Userlevel 7
Badge +27
Yes, you could use a MutationObserver or setInterval. Since Qualtrics will only record fields it knows about, you'll probably need to record all the changes in one embedded variable and use a delimiter to separate values.

Hi, TomG I also working on this kind of measure. Can you explain more about this? I have almost no knowledge of JavaScript.

Have you succeeded applying this hsh13 ?

Thank you!

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/40620#Comment_40620You would use JavaScript to record each time the slider moved. There are two ways you can use JS to do this: (1) A MutationObserver would let you capture each time the slider moved; (2) With setInterval you would check the value of the slider every x milliseconds and compare it to the previous value to see if it changed. Do an Internet search on both for more details. Either way, each time the value changes you would capture the value of slider and the current time in the video and save them to a JS object. At the end, convert the JS object to a json string and save it as an embedded data value.

Hello! I'm also working on implementing this exact thing, but I can't find any examples of how to implement "setInterval" for grabbing slider ratings every second and recording that data. Is there any similar implementation examples available?

Badge +1

Hello! I'm adding on to the list of people interested in this - has anyone gotten this to work? I'm also a JS newbie so any help or example code would be greatly appreciated. If you used any alternatives, please let me know as well.

Badge +1

TomG would you be willing to look over the code I have so far and see what I'm missing? I've created this and have set the sliderData_0, sliderData_1, ... variables in the survey flow before the block with the slider that has the JS. However, in the survey responses I'm not seeing those values being populated. Any advice?
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
  // Set up the slider element
  var slider = document.getElementById("QID1");


  // Set up the interval to capture the slider value every second
  var interval = setInterval(function() {
    saveSliderValue();
  }, 1000);


  // Set up the variables for the slider data
  var sliderDataCount = 0;


  // Define a function to save the slider value as an embedded data variable
  function saveSliderValue() {
    // Get the current value of the slider
    var value = slider.value;


    // Save the slider value as an embedded data variable
    Qualtrics.SurveyEngine.setEmbeddedData("sliderData_" + sliderDataCount, value);


    // Increment the count variable
    sliderDataCount++;
  }


  // Save the number of slider data points captured as an embedded data variable on survey submission
  Qualtrics.SurveyEngine.addOnPageSubmit(function() {
    clearInterval(interval);
    Qualtrics.SurveyEngine.setEmbeddedData("sliderDataCount", sliderDataCount);
  });
});

Leave a Reply