How can I track the timestamps of each answer in a matrix question? | XM Community
Skip to main content

I want to run an experiment where the participants have to click on the right boxes of a matrix question in the right order. The first approach that came into my mind was to track the timestampts of each click and if (suppose that the right boxes were clicked) time_1

Hi @Quavid 

Any insights? I am facing a similar situation. 


Could you take a screenshot/ create an image of the Matrix question, then use that image in a Hot Spot/ Heat Map type question in conjunction with the timing question. Would that give you the time and which point was selected? I’m sure there is a more elegant solution out there 😁


Hi @ohadeis, I found a post I think will be helpful to you. In that, cbhavsar provides some code that will record the timestamp if a specific cell in a likert matrix is selected.

To give it a try, first create the Embedded Data fields of "r1", "r2", and "r3" and put them at the top of the Survey Flow. These fields will record the timestamp for each matrix row click.

Then create a Matrix question with 3 statements and 3 scale points and add the below to the question's JavaScript in the OnReady section. It will record time stamps for when the 1st scale point is clicked in the 1st row, the 3rd scale point is clicked in the 2nd row, and the 2nd scale point is clicked in the 3rd row. Adjust as needed for the ‘correct’ answer choices in the matrix.

this.questionclick = function(e,el)
{
if (el.type == 'radio')
{
var rowNum = el.id.split('~')(2];
var colNum = el.id.split('~')(3];
if (rowNum == 1 && colNum == 1) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r1', timestamp);
}
if (rowNum == 2 && colNum == 3) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r2', timestamp);
}
if (rowNum == 3 && colNum == 2) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r3', timestamp);
}
}
}

Alternatively, you could use to the below to record when any scale point is clicked in each row:

this.questionclick = function(e,el)
{
if (el.type == 'radio')
{
var rowNum = el.id.split('~')(2];
if (rowNum == 1) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r1', timestamp);
}
if (rowNum == 2) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r2', timestamp);
}
if (rowNum == 3) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r3', timestamp);
}
}
}

 


Thanks @Tom_1842 , this looks like a huge step in the right direction.

I can see the code refers to a radio button. Happen to know what should change in the syntax if I’m interesed in a matrix table with text entry type? I would like to record the time stamp for clicking on the text box. 

(Do I even need the first if clause? What would go wrong if I omit it?)

Just for context, I am familiar with programming in general, but not with JavaScript, so your help sheds light for what’s missing and is much appreciated!


@ohadeis removing the if type==radio should work. Try using the below:

this.questionclick = function(e,el)
{
var rowNum = el.id.split('~'))2];
var colNum = el.id.split('~'))3];
if (rowNum == 1 && colNum == 1) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r1', timestamp);
}
if (rowNum == 2 && colNum == 3) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r2', timestamp);
}
if (rowNum == 3 && colNum == 2) {
var timestamp = new Date().toISOString();
Qualtrics.SurveyEngine.setEmbeddedData('r3', timestamp);
}
}

 


Leave a Reply