A practical tutorial for implementing fMRI experiments with jsPsych
Abstract jsPsych is widely used for online behavioral experiments but also supports offline laboratory use, opening possibilities for neurophysiological research. However, the practical value of these applications has received far less attention. This tutorial uses functional magnetic resonance imaging (fMRI) to show how existing jsPsych-based experiments can be adapted for scanner-based use. We review the current landscape of behavioral experiment software and highlight an overlooked methodological application of jsPsych in fMRI research. Because supported browsers are often already installed, jsPsych typically requires no additional software installation or separate runtime configuration, limiting setup-related problems. We outline how jsPsych can handle three core technical requirements of fMRI experiments: synchronization with scanner acquisition, response collection through scanner-compatible input devices, and temporal control over stimulus presentation and event logging. On this basis, we provide a step-by-step implementation guide for researchers new to jsPsych and those adapting existing jsPsych experiments for fMRI. Starting with local setup, the guide uses configurable code to demonstrate scanner trigger integration and temporal alignment, button-box responses using native multiple-choice and adapted continuous-slider formats, and structured data saving (code available at https://osf.io/z2xmh/). We further discuss practical considerations, including workflow organization, data management, hardware setup, and compatibility testing prior to formal data collection. More broadly, using jsPsych may simplify cross-site deployment and maintain task consistency across research stages, providing a shared basis for multimodal data integration. From an open-science perspective, it may also enhance portability, transparency, and reproducibility.
Authors
- Gabriela Rosenblau (ORCID: https://orcid.org/0000-0001-6122-0857)
- Josué García‐Arch (ORCID: https://orcid.org/0000-0002-2412-9090)
- Xiong Hu
- Yen-Wen Chen (ORCID: https://orcid.org/0000-0001-7974-1132)
- Christoph Korn
Institutions
- George Washington University (US)
- Heidelberg University (DE)
- NeuroDevelopment Center (US)
- Center for Autism and Related Disorders (US)
Publication Details
- Journal
- Behavior Research Methods
- Published
- 2026-11-30
- DOI
- https://doi.org/10.3758/s13428-026-03245-0
- Primary Topic
- Neural and Behavioral Psychology Studies
- Type
- article
- Field-Weighted Citation Impact
- 0.00