Psychomotor Vigilance testing using Javascript | XM Community
Skip to main content
Hi all,



Newbie here trying to get things into perspective. I'm looking to incorporate a reaction test within the platform using javascript and measure the reaction time of the individual taking the test. I was looking at using something like this: https://codepen.io/cliff538/pen/Eslxr



Ideally what I would want is to take 8 samples from the individual and create reaction time timestamps, then create an average reaction time for the day. This would likely be put into an embedded field and reported on. We would track this daily.



What would be the smartest way to do this?



Thanks!
Assuming you can put each of the 8 samples on it's own page, you shouldn't have to use javascript as Qualtrics has a built in timing question. See the documentation page here: https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/question-types-guide/advanced/timing/



You can then use embedded data, piping, and math functions to calculate the respondent's average reaction time for the day.



* Piping: https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/piped-text-overview/

Example:

!



* Embedded Data: https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/embedded-data/

* Math Operations: https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/

I have trouble with the math operations always working when I put in parentheses so the screen shot of the survey flow is a broken out into steps for your calculation



Your Survey Flow will look like:

!



And the survey itself will look like:

!



I did this for 2 conditions but you can easily expand it to the 8 you want in your experiment.



Hints: when calculating sum you can pipe in the value from the timing question

1. Make sure you are selecting the value (so the variable without " - Description" after it)

2. Add spaces between variable names and +

3. the whole thing should be wrapped inside of $e{ }



You can use the same exact syntax for the Average variable.

If you want to do calculations on Sum and Average across respondents e.g. the Average of the average, then you need to go into Options in the green Embedded Data box and change Variable type from Text to Number Set.
@bstrahin Thank you so much for this! I know there was some way to possibly leverage the timing system to manage this but I didn't have the technical skills yet to put it all together. With your advice I've managed to create a reaction time test with averages and the ability to report on them using the timing of the first press. It also works on mobile which is awesome 😃 Much appreciated!

Hi!
I have created a similar task. And was wondering if it was possible to get the timer to display milliseconds on the timer? I suspect this will be CSS related, but i have no idea where to start!


Leave a Reply