Running the course on Cognition.run or JATOS
Begin with ordinary local files in Meetings 1-2. In Meeting 3, use the local JATOS walkthrough to import, run, inspect, export, and transfer a working task. From then on, use Cognition.run or JATOS to run platform pilots. Students learn experiment code, not server administration. The local versions in this folder are a convenient preview/offline fallback.
What the platform does
The platform makes the experiment available at a link and stores its results. jsPsych handles the participant’s trials and responses. Our platform integration should remain short; students do not need custom upload, retry, or backup interfaces.
Prepare a platform copy
The instructor can export any starter or solution:
python3 .tools/package-experiment.py 05_Mouse_tracking_and_deployment/solutions/workshop
The standalone folder/ZIP under .build/packages/ contains the task, dependencies, assets, local entry page, a JATOS entry page, and cognition.js. The .zip contains source files; the separate .jzip includes JATOS study metadata and can be imported directly. Students can receive the prepared platform copy directly; they do not need to run this packaging script.
Cognition.run
- Create a classroom task and open its source-code editor.
- Use jsPsych 8 with the course’s plugin versions. Configure the needed JS/CSS libraries through the platform’s library facilities; do not load a second copy of jsPsych core.
- Paste the exported
cognition.js. It contains the supplied summary functions, item list, and experiment. Its initialization has no local-download or JATOS completion callback: Cognition handles result saving. - Apply the included
course.css. For Meeting 4, upload the SVG assets and replace their paths in the item list with the platform’s actual asset URLs. - Run the task via its participant link, complete it, and retrieve the result from the dashboard. Check the expected task rows and final trial before distributing the link.
The exact project version selector and asset URLs must be checked in the actual account. The course does not assume a version from the platform’s older examples. Follow Cognition’s first-task guide and getting started.
JATOS
- Import the generated
.jzipusing JATOS Import study. Alternatively, create a component and place the source ZIP’s extracted files in its study assets. - Set the component HTML path to
index-jatos.htmlin the exported folder. JATOS suppliesjatos.js; do not copy a replacement into the package. - Launch the component through JATOS. The exported code differs from the local task in two small places:
jatos.onLoad(() => {
const jsPsych = initJsPsych({
on_finish: () => {
jatos.startNextComponent(jsPsych.data.get().json());
}
});
// Define the same trials and timeline here.
jsPsych.run(timeline);
});
The completion call sends the data and moves to the next component, or finishes the study when this is the last component. There is no custom retry UI to explain. For mouse tracking, keep the extension registration in initJsPsych alongside on_finish.
For Meeting 3’s mapping groups, the JATOS export reads jatos.urlQueryParameters.group inside onLoad. Create a Personal Multiple link under Study Links for classroom testing. Add ?group=B to that /publix/... link (or &group=B if it already has a query). The dashboard’s Run URL does not forward these custom parameters. JATOS also redirects study links, so reading the final component’s browser URL is insufficient. The local version keeps its ordinary URLSearchParams line. Verify the displayed mapping and the saved group. See JATOS URL parameters.
- Retrieve a complete result in JATOS. Check item IDs, conditions, responses, and the final trial. Test the instance’s handling of a connection problem in a disposable pilot before class; that is instructor preparation, not an additional student programming assignment.
Reference: official jsPsych/JATOS integration.
Local fallback
Serve the folder locally and open index.html. The supplied finish panel downloads CSV/JSON onto that computer. It does not upload to either platform. Download and reopen the files before refreshing. An absent server should not stop students learning trial structure and data checks.
What students must verify
Know which task link/version was run, where results are stored, and how to export them. Retrieve one pilot and inspect its counts and final row. A finished screen alone is not sufficient evidence. No API credentials belong in the task’s browser code.
For research use beyond this classroom prototype, use the actual institutional participant-information, consent, data-access, and retention arrangements. The teaching examples are not approved research protocols. Preloading also does not establish physical timing accuracy; see jsPsych timing guidance.