Retrieve the reaction time in Qualtrics

2019-08-22 17:37发布

问题:

I wrote the following script to measure the respondent's reaction time for each question. My question is how can I retrieve the reaction time?

Qualtrics.SurveyEngine.addOnload(function(){

	var starttime = new Date().getTime();

	var that = this;

	this.hideNextButton();

	this.questionclick = function(event,element){

		if (element.type == 'radio') {
			var endtime = new Date().getTime();
			var reactiontime = endtime - starttime;
			document.getElementById("QR~"+this.questionID).value = document.getElementById("QR~"+this.questionID).value + "X" + reactiontime + ",";
		}
	that.clickNextButton();
	}

});

回答1:

You can save reaction time to an embedded data variable. Define reactiontime as an embedded data variable in the survey flow prior to the question block. Then:

Qualtrics.SurveyEngine.addOnReady(function(){
    var starttime = new Date().getTime();
    $('NextButton').hide();

    this.questionclick = function(event,element){
        if (element.type == 'radio') {
            var endtime = new Date().getTime();
            var reactiontime = endtime - starttime;
            Qualtrics.SurveyEngine.setEmbeddedData('reactiontime', reactiontime);
            $('NextButton').click();           
        }
    }

});