How do I add timing questions to randomized block? | XM Community
Skip to main content
Question

How do I add timing questions to randomized block?


Forum|alt.badge.img+1

Hello! I need to track the amount of time a participant spends on each question, but the questions have to be randomized for my experiment. I know that randomizing questions breaks the functionality of the timing question, so I was wondering if there’s any way to code the time tracking for each question using javascript? Thanks!

11 replies

Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • 1091 replies
  • September 8, 2023

@ksheetz No need for java script, advance randomization will give you what you want. Take this for example:

I’m randomizing show 3 out of 4 question in my pool so I make 3 timing questions. Place them crisscrossing with each other & show 2 questions per page to make a pair. So I will have 3 page submit time for 1st, 2nd and 3rd question.
Let me know if this helps.


Forum|alt.badge.img+1
  • Author
  • 1 reply
  • September 11, 2023

@dxconnamnguyen this won’t work for me, as I have to know the participants time spent on each specific question. Therefore, the timing questions and the stimulus need to be grouped together and then randomized. While what you showed was extremely helpful in general, it doesn’t work for my study since I wouldn’t be able to link the timing back to the corresponding question. I appreciate the answer though!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5921 replies
  • September 11, 2023

@ksheetz,

You can use JS to time each question and save it in an embedded data field. For example:

Qualtrics.SurveyEngine.addOnReady(function() {
	var start = Date.now();
	Qualtrics.SurveyEngine.addOnPageSubmit(function() {
		Qualtrics.SurveyEngine.setEmbeddedData("Q1ms",Date.now()-start);
	});
});

 


Forum|alt.badge.img
  • 3 replies
  • September 13, 2023

hello,

TomG wrote:

@ksheetz,

You can use JS to time each question and save it in an embedded data field. For example:

Qualtrics.SurveyEngine.addOnReady(function() {
	var start = Date.now();
	Qualtrics.SurveyEngine.addOnPageSubmit(function() {
		Qualtrics.SurveyEngine.setEmbeddedData("Q1ms",Date.now()-start);
	});
});

 

 

TomG, could you please  specify “ an embeedingd data field”,  how can I find this entrance and put the js code in it?

 

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5921 replies
  • September 13, 2023
Olina wrote:

hello,

TomG wrote:

@ksheetz,

You can use JS to time each question and save it in an embedded data field. For example:

Qualtrics.SurveyEngine.addOnReady(function() {
	var start = Date.now();
	Qualtrics.SurveyEngine.addOnPageSubmit(function() {
		Qualtrics.SurveyEngine.setEmbeddedData("Q1ms",Date.now()-start);
	});
});

 

 

TomG, could you please  specify “ an embeedingd data field”,  how can I find this entrance and put the js code in it?

 

In your survey flow, before your randomized block, create an embedded data field to capture the time in milliseconds for each question (Q1ms, Q2ms, etc.).

Add the JS above to each question you want to time, and change “Q1ms” to the appropriate name.


Forum|alt.badge.img
  • 2 replies
  • October 30, 2023
TomG wrote:
Olina wrote:

hello,

TomG wrote:

@ksheetz,

You can use JS to time each question and save it in an embedded data field. For example:

Qualtrics.SurveyEngine.addOnReady(function() {
	var start = Date.now();
	Qualtrics.SurveyEngine.addOnPageSubmit(function() {
		Qualtrics.SurveyEngine.setEmbeddedData("Q1ms",Date.now()-start);
	});
});

 

 

TomG, could you please  specify “ an embeedingd data field”,  how can I find this entrance and put the js code in it?

 

In your survey flow, before your randomized block, create an embedded data field to capture the time in milliseconds for each question (Q1ms, Q2ms, etc.).

Add the JS above to each question you want to time, and change “Q1ms” to the appropriate name.

TomG, I’m finding your code is working well for me too (I had a very similar application as the original one for this thread and thank you!). 

However, in my case I need to create a survey where I am drawing on a randomized selection of 100 questions from a total possible pool of 1,700 questions.

What I’m trying to discern is if I can avoid having to manually override that ID value 1,699 times to specifically name the question (as in “Q1ms,” “Q5ms,” etc.) or if there’s some other way to express that embedded data referent in a way where the JS code can automatically populate it (something like: “this question number” + “ms” ?).


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5921 replies
  • October 30, 2023

You could use the the question id (i.e., QID1):

Qualtrics.SurveyEngine.setEmbeddedData(this.questionId+"ms",Date.now()-start);

However, you would need to define all of them in the survey flow to capture them in your response data.


Forum|alt.badge.img
  • 2 replies
  • October 30, 2023
TomG wrote:

You could use the the question id (i.e., QID1):

Qualtrics.SurveyEngine.setEmbeddedData(this.questionId+"ms",Date.now()-start);

However, you would need to define all of them in the survey flow to capture them in your response data.

Thanks very much! I’ll try this out.


Forum|alt.badge.img+1
  • 2 replies
  • June 26, 2024
TomG wrote:
Olina wrote:

hello,

TomG wrote:

@ksheetz,

You can use JS to time each question and save it in an embedded data field. For example:

Qualtrics.SurveyEngine.addOnReady(function() {
	var start = Date.now();
	Qualtrics.SurveyEngine.addOnPageSubmit(function() {
		Qualtrics.SurveyEngine.setEmbeddedData("Q1ms",Date.now()-start);
	});
});

 

 

TomG, could you please  specify “ an embeedingd data field”,  how can I find this entrance and put the js code in it?

 

In your survey flow, before your randomized block, create an embedded data field to capture the time in milliseconds for each question (Q1ms, Q2ms, etc.).

Add the JS above to each question you want to time, and change “Q1ms” to the appropriate name.

In the embedded data field in survey flow, would I select Q_TotalDuration and then add the JS above to each question?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5921 replies
  • June 26, 2024

@JulienS - Q_TotalDuration always contains the duration from the start of the question, and doesn’t pertain to what this thread is about. In order for embedded data to be saved in response data, it has to be defined in the survey flow. So, you either need to (1) define an embedded data field for each question you want to time in the survey flow (e.g., Q1ms, Q2ms, Q3ms, etc.) or (2) save all the times in a single delimited or json string that you append each timed question to.


Forum|alt.badge.img+1
  • 2 replies
  • June 26, 2024
TomG wrote:

@JulienS - Q_TotalDuration always contains the duration from the start of the question, and doesn’t pertain to what this thread is about. In order for embedded data to be saved in response data, it has to be defined in the survey flow. So, you either need to (1) define an embedded data field for each question you want to time in the survey flow (e.g., Q1ms, Q2ms, Q3ms, etc.) or (2) save all the times in a single delimited or json string that you append each timed question to.

Thank you very much, Tom. I understand a bit better now. I’m new to Qualtrics, so I’ve got a bit of learning to do.

 

Thanks to your explanation in this thread, I understand I have to add an embedded data item in survey flow and use the code you provided above for each question. Another question I have is how to embed the code using the embedded data option. I’m not quite which option to choose as there are so many to choose from:

 

 

Do I select from the list of options in “Survey Metadata”? There are many options there. Or, do I add the code into the “Set a Value Now” option?

 

Thank you!


Leave a Reply