jsPsych and JATOS
JATOS basically cares for the server side: it stores result data, does worker management etc. JATOS doesn't care so much for what happens in the browser itself - your HTML, JavaScript and CSS. Of course you can write this all yourself, but you could also use a framework for this. A very good one is jsPsych.
In our example studies are a couple of jsPsych ones.
Here are the necessary changes if you want to adapt your jsPsych experiment so that it runs within (and sends the result data to) JATOS. Additionally you can have a look at Adapt Pre written Code to run it in JATOS.
Every jsPsych version works slightly different. Here we explain the steps for jsPsych 7 (for older versions have a look here).
How to turn your jsPsych 7 experiment into a JATOS study
Include the jatos.js library in the
<head>
of your HTML<script src="jatos.js"></script>
Tell jsPsych to send your result data to JATOS. If you want add a 'Cancel' button with
jatos.addAbortButton
, add the line included below (omit if you don't want the automatic abort button).var jsPsych = initJsPsych({
on_trial_start: jatos.addAbortButton,
on_finish: () => jatos.endStudy(jsPsych.data.get().json())
});Wrap jsPsych's run in
jatos.onLoad
.jatos.onLoad(() => {
jsPsych.run(timeline);
});
That's all. Have a look at the 'Simple Reaction Time Task' in our example studies to see a full example with jsPsych 7.