I try to get data on the mere slider positions entered instead of the values which belonged to the positions entered with the slider.
That meants, I would like to know which distances the entered values have from each other in cm rather than knowing what numbers the participants entered with the slider.
I try to do this by using embedded data. I created an embedded data field in the survey flow just below the block with the slider question which is named “SliderPosition”.
In the slider question I added this JavaScript code so that I get shown in the embedded data afterwards the slider position:
Qualtrics.SurveyEngine.addOnload(function() {
// Retrieve the slider element by its question ID
var slider = this.getQuestionContainer().querySelector('inputctype="range"]');
// Get the minimum and maximum values of the slider
var min = parseInt(slider.min);
var max = parseInt(slider.max);
// Add an event listener to capture the slider position
slider.addEventListener('input', function() {
// Get the position value
var position = (parseInt(slider.value) - min) / (max - min);
// Set the position value as embedded data
Qualtrics.SurveyEngine.setEmbeddedData('SliderPosition', position);
});
});
Qualtrics.SurveyEngine.addOnReady(function() {
/* Place your JavaScript here to run when the page is ready */
});
Qualtrics.SurveyEngine.addOnUnload(function() {
/* Place your JavaScript here to run when the page is unloaded */
});
However, in the Results section the embedded data field “SliderPosition” stays empty no matter how many results I gathered. Does somebody know what could be wrong here?