I am running a study where participants need to watch a video while simultaneously completing a motor tapping task where they just have to continuously press 4 keys until the video finishes. For example, they have to press, "C", "B", "V", and "N" continuously in that sequence. Is there a way to figure out whether Qualtrics can collect information on which keys the participants are pressing or if they pressed the correct keys in that same sequence? I am very new to Qualtrics and haven't found any information that is helpful.
Hi Chelseachelsea_blake,
The only way to capture keypresses will be by using Javascript in your question. It is a programming language, and probably the only way you can solve this problem.
There is a function to capture key presses on javascript; keyup.
For your purposes you might get started with something like this:
//add Javascript to your Qualtrics question and insert into the page load function
//when the user presses a key
document.getElementsByTagName('body')[0].onkeyup = function(e) {
var ev = e || event;
//perform some action to find which key is pressed
//for example...
if(ev.keyCode == 67) {
//the keyCode for the letter "c" is 67
//so if the letter "c" is pressed, we do something in here
}
}
};
You can find a lot of key codes here: http://gcctech.org/csc/javascript/javascript_keycodes.htm
Of course what you do with that key press information depends on your use-case. I imagine you (ideally) want to keep track of the keys the user is pressing so you may need to store it in an embedded field. You can find lots of information on doing that here on the Qualtrics Community Forum, but you will need to do a little Javascript research on Google as well.
Good luck!
Thankyou for the information bgooldfed I will look into this and see if I can get it to work!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.