Thursday, July 26, 2012

Question's timestamp on Qualtrics

If you want Qualtrics to record the full timestamp (mm/dd/yyyy hh:mm:ss.ss) a participant viewed or clicked on a question, and not just the response time, you can use this javascript code:

Qualtrics.SurveyEngine.addOnload(function()
{  
  var timeStampOfOnLoad = new Date();
  Qualtrics.SurveyEngine.setEmbeddedData('timeStampOfOnLoad_QID1', timeStampOfOnLoad);
  //alert('QID1 '+timeStampOfOnLoad);
  this.questionclick = function(event,element){
    var timeStampOfAnswer = new Date();
    Qualtrics.SurveyEngine.setEmbeddedData('timeStampOfAnswer_QID1', timeStampOfAnswer);
    //alert('QID1 '+timeStampOfAnswer);
  }
}
);

Find your question on Qualtrics and click on the let-hand button and choose "Add Javascript". Copy and paste the above code (in whole) and change the "QID" parameter to your question's ID. 
You will also need to add an Embedded Data element to your survey flow with the same name as the value after the ".setEmbeddedData" function in the code (e.g., timeStampOfOnLoad_QID1 ). The first var in the code records the timestamp the question was viewable to the participants and the second one records the timestamp of the first click the participant made. If you want both, create two Embedded Data elements in your survey flow.

21 comments:

  1. I'm not too familiar with code. When this is used in Qualtrics nano seconds are not displayed. Is there a way to get nano seconds?

    ReplyDelete
    Replies
    1. Not that I know of. You can try to add a "timing" question to that page to add some milliseconds, but I'm not sure that would help. Let me know if you found a solution. Eyal.

      Delete
  2. Thanks a bunch for this! Do you know how to get it to work with Matrix Tables? I've been having success with other types, but for some reason, my prior method is not working on them. Perhaps I have the wrong QID? Do I use a different one for Matrix Tables? Thank you.

    ReplyDelete
  3. It's possible that matrix tables have different QIDs. You can try emailing Qualtrics' support and see if they can help. Let me know if you found a solution. Thanks, Eyal.

    ReplyDelete
  4. this was very helpful, and straightforward.. thank you. another question: can this be applied to text entry forms (i.e., multiple fields within a single QID)? here's a screenie, in case my description is weak: http://grab.by/tuny

    ReplyDelete
  5. Very, very helpful! Thank you for helping solve my research dilemma!

    ReplyDelete
  6. Is there a way to prevent the click timestamp from updating if the respondent clicks on the question again? I want to record the first time they click on a question only. Thanks!

    ReplyDelete
  7. I am interested in timestamping when the person clicks the next button, is that possible?

    ReplyDelete