jspsych 6.2.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -29
- package/css/jspsych.css +39 -39
- package/dist/JsPsych.d.ts +112 -0
- package/dist/TimelineNode.d.ts +34 -0
- package/dist/index.browser.js +3164 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.browser.min.js +2 -0
- package/dist/index.browser.min.js.map +1 -0
- package/dist/index.cjs +3158 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3152 -0
- package/dist/index.js.map +1 -0
- package/dist/migration.d.ts +3 -0
- package/dist/modules/data/DataCollection.d.ts +45 -0
- package/dist/modules/data/DataColumn.d.ts +15 -0
- package/dist/modules/data/index.d.ts +25 -0
- package/dist/modules/data/utils.d.ts +3 -0
- package/dist/modules/extensions.d.ts +22 -0
- package/dist/modules/plugin-api/HardwareAPI.d.ts +15 -0
- package/dist/modules/plugin-api/KeyboardListenerAPI.d.ts +34 -0
- package/dist/modules/plugin-api/MediaAPI.d.ts +27 -0
- package/dist/modules/plugin-api/SimulationAPI.d.ts +41 -0
- package/dist/modules/plugin-api/TimeoutAPI.d.ts +5 -0
- package/dist/modules/plugin-api/index.d.ts +8 -0
- package/dist/modules/plugins.d.ts +129 -0
- package/dist/modules/randomization.d.ts +35 -0
- package/dist/modules/turk.d.ts +40 -0
- package/dist/modules/utils.d.ts +7 -0
- package/package.json +32 -15
- package/src/JsPsych.ts +884 -0
- package/src/TimelineNode.ts +536 -0
- package/src/index.ts +71 -0
- package/src/migration.ts +37 -0
- package/src/modules/data/DataCollection.ts +198 -0
- package/src/modules/data/DataColumn.ts +86 -0
- package/src/modules/data/index.ts +174 -0
- package/src/modules/data/utils.ts +75 -0
- package/src/modules/extensions.ts +23 -0
- package/src/modules/plugin-api/HardwareAPI.ts +32 -0
- package/src/modules/plugin-api/KeyboardListenerAPI.ts +165 -0
- package/src/modules/plugin-api/MediaAPI.ts +337 -0
- package/src/modules/plugin-api/SimulationAPI.ts +181 -0
- package/src/modules/plugin-api/TimeoutAPI.ts +16 -0
- package/src/modules/plugin-api/index.ts +28 -0
- package/src/modules/plugins.ts +158 -0
- package/src/modules/randomization.ts +327 -0
- package/src/modules/turk.ts +99 -0
- package/src/modules/utils.ts +30 -0
- package/.github/workflows/jest.yml +0 -20
- package/code-of-conduct.md +0 -56
- package/contributors.md +0 -61
- package/docs/CNAME +0 -1
- package/docs/about/about.md +0 -18
- package/docs/about/contributing.md +0 -43
- package/docs/about/license.md +0 -25
- package/docs/about/support.md +0 -7
- package/docs/core_library/jspsych-core.md +0 -661
- package/docs/core_library/jspsych-data.md +0 -589
- package/docs/core_library/jspsych-pluginAPI.md +0 -510
- package/docs/core_library/jspsych-randomization.md +0 -397
- package/docs/core_library/jspsych-turk.md +0 -102
- package/docs/img/blue.png +0 -0
- package/docs/img/folder-setup.png +0 -0
- package/docs/img/folder-with-html.png +0 -0
- package/docs/img/githubreleases.jpg +0 -0
- package/docs/img/jspsych-favicon.png +0 -0
- package/docs/img/jspsych-logo-no-text-mono.svg +0 -493
- package/docs/img/jspsych-logo.jpg +0 -0
- package/docs/img/orange.png +0 -0
- package/docs/img/palmer_stim.png +0 -0
- package/docs/img/progress_bar.png +0 -0
- package/docs/img/visual_search_example.jpg +0 -0
- package/docs/index.md +0 -9
- package/docs/overview/browser-device-support.md +0 -35
- package/docs/overview/callbacks.md +0 -140
- package/docs/overview/data.md +0 -281
- package/docs/overview/exclude-browser.md +0 -32
- package/docs/overview/experiment-options.md +0 -121
- package/docs/overview/fullscreen.md +0 -36
- package/docs/overview/media-preloading.md +0 -91
- package/docs/overview/mturk.md +0 -77
- package/docs/overview/progress-bar.md +0 -110
- package/docs/overview/record-browser-interactions.md +0 -23
- package/docs/overview/running-experiments.md +0 -95
- package/docs/overview/timeline.md +0 -387
- package/docs/overview/trial.md +0 -142
- package/docs/plugins/creating-a-plugin.md +0 -79
- package/docs/plugins/jspsych-animation.md +0 -40
- package/docs/plugins/jspsych-audio-button-response.md +0 -60
- package/docs/plugins/jspsych-audio-keyboard-response.md +0 -58
- package/docs/plugins/jspsych-audio-slider-response.md +0 -53
- package/docs/plugins/jspsych-call-function.md +0 -81
- package/docs/plugins/jspsych-canvas-button-response.md +0 -66
- package/docs/plugins/jspsych-canvas-keyboard-response.md +0 -68
- package/docs/plugins/jspsych-canvas-slider-response.md +0 -89
- package/docs/plugins/jspsych-categorize-animation.md +0 -60
- package/docs/plugins/jspsych-categorize-html.md +0 -52
- package/docs/plugins/jspsych-categorize-image.md +0 -53
- package/docs/plugins/jspsych-cloze.md +0 -45
- package/docs/plugins/jspsych-external-html.md +0 -70
- package/docs/plugins/jspsych-free-sort.md +0 -55
- package/docs/plugins/jspsych-fullscreen.md +0 -57
- package/docs/plugins/jspsych-html-button-response.md +0 -42
- package/docs/plugins/jspsych-html-keyboard-response.md +0 -51
- package/docs/plugins/jspsych-html-slider-response.md +0 -45
- package/docs/plugins/jspsych-iat-html.md +0 -64
- package/docs/plugins/jspsych-iat-image.md +0 -64
- package/docs/plugins/jspsych-image-button-response.md +0 -46
- package/docs/plugins/jspsych-image-keyboard-response.md +0 -57
- package/docs/plugins/jspsych-image-slider-response.md +0 -52
- package/docs/plugins/jspsych-instructions.md +0 -58
- package/docs/plugins/jspsych-maxdiff.md +0 -42
- package/docs/plugins/jspsych-rdk.md +0 -119
- package/docs/plugins/jspsych-reconstruction.md +0 -48
- package/docs/plugins/jspsych-resize.md +0 -39
- package/docs/plugins/jspsych-same-different-html.md +0 -53
- package/docs/plugins/jspsych-same-different-image.md +0 -66
- package/docs/plugins/jspsych-serial-reaction-time-mouse.md +0 -50
- package/docs/plugins/jspsych-serial-reaction-time.md +0 -57
- package/docs/plugins/jspsych-survey-html-form.md +0 -50
- package/docs/plugins/jspsych-survey-likert.md +0 -70
- package/docs/plugins/jspsych-survey-multi-choice.md +0 -48
- package/docs/plugins/jspsych-survey-multi-select.md +0 -53
- package/docs/plugins/jspsych-survey-text.md +0 -63
- package/docs/plugins/jspsych-video-button-response.md +0 -52
- package/docs/plugins/jspsych-video-keyboard-response.md +0 -48
- package/docs/plugins/jspsych-video-slider-response.md +0 -58
- package/docs/plugins/jspsych-visual-search-circle.md +0 -52
- package/docs/plugins/jspsych-vsl-animate-occlusion.md +0 -55
- package/docs/plugins/jspsych-vsl-grid-scene.md +0 -62
- package/docs/plugins/overview.md +0 -111
- package/docs/tutorials/hello-world.md +0 -144
- package/docs/tutorials/rt-task.md +0 -1107
- package/examples/add-to-end-of-timeline.html +0 -32
- package/examples/conditional-and-loop-functions.html +0 -63
- package/examples/css/jquery-ui.css +0 -1225
- package/examples/data-add-properties.html +0 -40
- package/examples/data-as-function.html +0 -36
- package/examples/data-from-timeline.html +0 -45
- package/examples/data-from-url.html +0 -21
- package/examples/demo-flanker.html +0 -108
- package/examples/demo-simple-rt-task.html +0 -104
- package/examples/demos/demo_1.html +0 -29
- package/examples/demos/demo_2.html +0 -43
- package/examples/demos/demo_3.html +0 -58
- package/examples/display-element-to-embed-experiment.html +0 -73
- package/examples/end-active-node.html +0 -52
- package/examples/end-experiment.html +0 -43
- package/examples/exclusions.html +0 -32
- package/examples/external_html/simple_consent.html +0 -4
- package/examples/img/1.gif +0 -0
- package/examples/img/10.gif +0 -0
- package/examples/img/11.gif +0 -0
- package/examples/img/12.gif +0 -0
- package/examples/img/2.gif +0 -0
- package/examples/img/3.gif +0 -0
- package/examples/img/4.gif +0 -0
- package/examples/img/5.gif +0 -0
- package/examples/img/6.gif +0 -0
- package/examples/img/7.gif +0 -0
- package/examples/img/8.gif +0 -0
- package/examples/img/9.gif +0 -0
- package/examples/img/age/of1.jpg +0 -0
- package/examples/img/age/of2.jpg +0 -0
- package/examples/img/age/of3.jpg +0 -0
- package/examples/img/age/om1.jpg +0 -0
- package/examples/img/age/om2.jpg +0 -0
- package/examples/img/age/om3.jpg +0 -0
- package/examples/img/age/yf1.jpg +0 -0
- package/examples/img/age/yf4.jpg +0 -0
- package/examples/img/age/yf5.jpg +0 -0
- package/examples/img/age/ym2.jpg +0 -0
- package/examples/img/age/ym3.jpg +0 -0
- package/examples/img/age/ym5.jpg +0 -0
- package/examples/img/backwardN.gif +0 -0
- package/examples/img/blue.png +0 -0
- package/examples/img/con1.png +0 -0
- package/examples/img/con2.png +0 -0
- package/examples/img/fixation.gif +0 -0
- package/examples/img/happy_face_1.jpg +0 -0
- package/examples/img/happy_face_2.jpg +0 -0
- package/examples/img/happy_face_3.jpg +0 -0
- package/examples/img/happy_face_4.jpg +0 -0
- package/examples/img/inc1.png +0 -0
- package/examples/img/inc2.png +0 -0
- package/examples/img/normalN.gif +0 -0
- package/examples/img/orange.png +0 -0
- package/examples/img/redX.png +0 -0
- package/examples/img/ribbon.jpg +0 -0
- package/examples/img/sad_face_1.jpg +0 -0
- package/examples/img/sad_face_2.jpg +0 -0
- package/examples/img/sad_face_3.jpg +0 -0
- package/examples/img/sad_face_4.jpg +0 -0
- package/examples/js/snap.svg-min.js +0 -21
- package/examples/jspsych-RDK.html +0 -58
- package/examples/jspsych-animation.html +0 -33
- package/examples/jspsych-audio-button-response.html +0 -52
- package/examples/jspsych-audio-keyboard-response.html +0 -62
- package/examples/jspsych-audio-slider-response.html +0 -55
- package/examples/jspsych-call-function.html +0 -32
- package/examples/jspsych-canvas-button-response.html +0 -95
- package/examples/jspsych-canvas-keyboard-response.html +0 -78
- package/examples/jspsych-canvas-slider-response.html +0 -67
- package/examples/jspsych-categorize-animation.html +0 -46
- package/examples/jspsych-categorize-html.html +0 -38
- package/examples/jspsych-categorize-image.html +0 -38
- package/examples/jspsych-cloze.html +0 -42
- package/examples/jspsych-free-sort.html +0 -97
- package/examples/jspsych-fullscreen.html +0 -44
- package/examples/jspsych-html-button-response.html +0 -46
- package/examples/jspsych-html-keyboard-response.html +0 -42
- package/examples/jspsych-html-slider-response.html +0 -53
- package/examples/jspsych-iat.html +0 -510
- package/examples/jspsych-image-button-response.html +0 -84
- package/examples/jspsych-image-keyboard-response.html +0 -78
- package/examples/jspsych-image-slider-response.html +0 -76
- package/examples/jspsych-instructions.html +0 -37
- package/examples/jspsych-maxdiff.html +0 -33
- package/examples/jspsych-reconstruction.html +0 -43
- package/examples/jspsych-resize.html +0 -34
- package/examples/jspsych-same-different-html.html +0 -28
- package/examples/jspsych-same-different-image.html +0 -33
- package/examples/jspsych-serial-reaction-time-mouse.html +0 -98
- package/examples/jspsych-serial-reaction-time.html +0 -54
- package/examples/jspsych-survey-html-form.html +0 -33
- package/examples/jspsych-survey-likert.html +0 -42
- package/examples/jspsych-survey-multi-choice.html +0 -40
- package/examples/jspsych-survey-multi-select.html +0 -42
- package/examples/jspsych-survey-text.html +0 -34
- package/examples/jspsych-video-button-response.html +0 -57
- package/examples/jspsych-video-keyboard-response.html +0 -53
- package/examples/jspsych-video-slider-response.html +0 -55
- package/examples/jspsych-visual-search-circle.html +0 -58
- package/examples/jspsych-vsl-animate-occlusion.html +0 -29
- package/examples/jspsych-vsl-grid-scene.html +0 -41
- package/examples/lexical-decision.html +0 -132
- package/examples/manual-preloading.html +0 -53
- package/examples/pause-unpause.html +0 -33
- package/examples/progress-bar.html +0 -62
- package/examples/sound/hammer.mp3 +0 -0
- package/examples/sound/sound.mp3 +0 -0
- package/examples/sound/speech_blue.mp3 +0 -0
- package/examples/sound/speech_green.mp3 +0 -0
- package/examples/sound/speech_joke.mp3 +0 -0
- package/examples/sound/speech_red.mp3 +0 -0
- package/examples/sound/tone.mp3 +0 -0
- package/examples/timeline-variables-sampling.html +0 -50
- package/examples/timeline-variables.html +0 -55
- package/examples/video/sample_video.mp4 +0 -0
- package/jspsych.js +0 -2796
- package/license.txt +0 -21
- package/mkdocs.yml +0 -104
- package/plugins/jspsych-animation.js +0 -189
- package/plugins/jspsych-audio-button-response.js +0 -247
- package/plugins/jspsych-audio-keyboard-response.js +0 -204
- package/plugins/jspsych-audio-slider-response.js +0 -262
- package/plugins/jspsych-call-function.js +0 -58
- package/plugins/jspsych-canvas-button-response.js +0 -199
- package/plugins/jspsych-canvas-keyboard-response.js +0 -155
- package/plugins/jspsych-canvas-slider-response.js +0 -207
- package/plugins/jspsych-categorize-animation.js +0 -266
- package/plugins/jspsych-categorize-html.js +0 -220
- package/plugins/jspsych-categorize-image.js +0 -222
- package/plugins/jspsych-cloze.js +0 -112
- package/plugins/jspsych-external-html.js +0 -112
- package/plugins/jspsych-free-sort.js +0 -444
- package/plugins/jspsych-fullscreen.js +0 -104
- package/plugins/jspsych-html-button-response.js +0 -188
- package/plugins/jspsych-html-keyboard-response.js +0 -149
- package/plugins/jspsych-html-slider-response.js +0 -202
- package/plugins/jspsych-iat-html.js +0 -284
- package/plugins/jspsych-iat-image.js +0 -286
- package/plugins/jspsych-image-button-response.js +0 -311
- package/plugins/jspsych-image-keyboard-response.js +0 -247
- package/plugins/jspsych-image-slider-response.js +0 -353
- package/plugins/jspsych-instructions.js +0 -237
- package/plugins/jspsych-maxdiff.js +0 -174
- package/plugins/jspsych-rdk.js +0 -1373
- package/plugins/jspsych-reconstruction.js +0 -134
- package/plugins/jspsych-resize.js +0 -166
- package/plugins/jspsych-same-different-html.js +0 -168
- package/plugins/jspsych-same-different-image.js +0 -169
- package/plugins/jspsych-serial-reaction-time-mouse.js +0 -213
- package/plugins/jspsych-serial-reaction-time.js +0 -247
- package/plugins/jspsych-survey-html-form.js +0 -171
- package/plugins/jspsych-survey-likert.js +0 -195
- package/plugins/jspsych-survey-multi-choice.js +0 -208
- package/plugins/jspsych-survey-multi-select.js +0 -232
- package/plugins/jspsych-survey-text.js +0 -185
- package/plugins/jspsych-video-button-response.js +0 -320
- package/plugins/jspsych-video-keyboard-response.js +0 -279
- package/plugins/jspsych-video-slider-response.js +0 -351
- package/plugins/jspsych-visual-search-circle.js +0 -259
- package/plugins/jspsych-vsl-animate-occlusion.js +0 -196
- package/plugins/jspsych-vsl-grid-scene.js +0 -103
- package/plugins/template/jspsych-plugin-template.js +0 -35
- package/tests/README.md +0 -7
- package/tests/jsPsych/default-iti.test.js +0 -51
- package/tests/jsPsych/default-parameters.test.js +0 -58
- package/tests/jsPsych/endexperiment.test.js +0 -49
- package/tests/jsPsych/events.test.js +0 -369
- package/tests/jsPsych/init.test.js +0 -48
- package/tests/jsPsych/loads.test.js +0 -7
- package/tests/jsPsych/min-rt.test.js +0 -58
- package/tests/jsPsych/progressbar.test.js +0 -202
- package/tests/jsPsych/timeline-variables.test.js +0 -254
- package/tests/jsPsych/timelines.test.js +0 -498
- package/tests/jsPsych.data/datacollection.test.js +0 -116
- package/tests/jsPsych.data/datacolumn.test.js +0 -50
- package/tests/jsPsych.data/datamodule.test.js +0 -152
- package/tests/jsPsych.data/dataparameter.test.js +0 -251
- package/tests/jsPsych.data/interactions.test.js +0 -109
- package/tests/jsPsych.pluginAPI/pluginapi.test.js +0 -144
- package/tests/jsPsych.randomization/randomziation.test.js +0 -27
- package/tests/jsPsych.utils/utils.test.js +0 -58
- package/tests/media/blue.png +0 -0
- package/tests/media/orange.png +0 -0
- package/tests/media/sample_video.mp4 +0 -0
- package/tests/media/sound.mp3 +0 -0
- package/tests/plugins/plugin-animation.test.js +0 -35
- package/tests/plugins/plugin-audio-button-response.test.js +0 -15
- package/tests/plugins/plugin-audio-keyboard-response.test.js +0 -15
- package/tests/plugins/plugin-audio-slider-response.test.js +0 -15
- package/tests/plugins/plugin-call-function.test.js +0 -49
- package/tests/plugins/plugin-categorize-animation.test.js +0 -274
- package/tests/plugins/plugin-categorize-html.test.js +0 -17
- package/tests/plugins/plugin-categorize-image.test.js +0 -17
- package/tests/plugins/plugin-cloze.test.js +0 -140
- package/tests/plugins/plugin-free-sort.test.js +0 -112
- package/tests/plugins/plugin-fullscreen.test.js +0 -41
- package/tests/plugins/plugin-html-button-response.test.js +0 -161
- package/tests/plugins/plugin-html-keyboard-response.test.js +0 -139
- package/tests/plugins/plugin-html-slider-response.test.js +0 -155
- package/tests/plugins/plugin-iat-html.test.js +0 -328
- package/tests/plugins/plugin-iat-image.test.js +0 -308
- package/tests/plugins/plugin-image-button-response.test.js +0 -183
- package/tests/plugins/plugin-image-keyboard-response.test.js +0 -154
- package/tests/plugins/plugin-image-slider-response.test.js +0 -183
- package/tests/plugins/plugin-instructions.test.js +0 -66
- package/tests/plugins/plugin-maxdiff.test.js +0 -39
- package/tests/plugins/plugin-rdk.test.js +0 -17
- package/tests/plugins/plugin-reconstruction.test.js +0 -16
- package/tests/plugins/plugin-resize.test.js +0 -16
- package/tests/plugins/plugin-same-different-html.test.js +0 -17
- package/tests/plugins/plugin-same-different-image.test.js +0 -17
- package/tests/plugins/plugin-serial-reaction-time-mouse.test.js +0 -42
- package/tests/plugins/plugin-serial-reaction-time.test.js +0 -69
- package/tests/plugins/plugin-survey-html-form.test.js +0 -44
- package/tests/plugins/plugin-survey-likert.test.js +0 -48
- package/tests/plugins/plugin-survey-multi-choice.test.js +0 -48
- package/tests/plugins/plugin-survey-multi-select.test.js +0 -72
- package/tests/plugins/plugin-survey-text.test.js +0 -115
- package/tests/plugins/plugin-video-button-response.test.js +0 -35
- package/tests/plugins/plugin-video-keyboard-response.test.js +0 -35
- package/tests/plugins/plugin-video-slider-response.test.js +0 -34
- package/tests/plugins/plugin-visual-search-circle.test.js +0 -16
- package/tests/plugins/plugin-vsl-animate-occlusion.test.js +0 -16
- package/tests/plugins/plugin-vsl-grid-scene.test.js +0 -16
- package/tests/testing-utils.js +0 -13
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Media Preloading
|
|
2
|
-
|
|
3
|
-
If an experiment uses image, audio, or video files as stimuli, it is a good idea to preload the files before running the experiment. Preloading files means that the subject's browser will download all of the files and store them in local memory on the subject's computer. This is important because loading a file is much faster if it is already in memory on the subject's computer. Without preloading, there will be noticeable delays in the display of media, which will affect any timing measurements (such as how long an image is displayed, or a subject's response time since first viewing an image). For particularly large files, like video, preloading content avoids lengthy pauses in the middle of the experiment that can be disruptive to the flow of the experiment.
|
|
4
|
-
|
|
5
|
-
Note that video preloading will not work when you run your experiment offline (e.g., by double-clicking on the HTML file), but it will work once your experiment is running online (hosted on a server). The [Cross-origin requests (CORS) and safe mode](running-experiments.md#cross-origin-requests-cors-and-safe-mode) section on the Running Experiments page contains more information about this.
|
|
6
|
-
|
|
7
|
-
## Automatic Preloading
|
|
8
|
-
|
|
9
|
-
jsPsych will automatically preload audio, video, and image files that are used as parameters for the standard set of plugins.
|
|
10
|
-
|
|
11
|
-
```javascript
|
|
12
|
-
// the image file img/file1.png is
|
|
13
|
-
// automatically preloaded before the experiment begins
|
|
14
|
-
var trial = {
|
|
15
|
-
type: 'image-keyboard-response',
|
|
16
|
-
stimulus: 'img/file1.png'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// the sound file is also preloaded automatically
|
|
20
|
-
var sound_trial = {
|
|
21
|
-
type: 'audio-keyboard-response',
|
|
22
|
-
stimulus: 'audio/hello.mp3'
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// the video file is preloaded automatically (as long as the experiment is running on a server)
|
|
26
|
-
var video_trial = {
|
|
27
|
-
type: 'video',
|
|
28
|
-
stimulus: ['video/sample_video.mp4']
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
jsPsych.init({
|
|
32
|
-
timeline: [trial]
|
|
33
|
-
});
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Manual preloading
|
|
37
|
-
|
|
38
|
-
If you are using media files in your experiment but they are not being passed directly as parameters to the trials (e.g., because you are using functions as parameters that return the audio, video, or images, or you are using timeline variables), then you can manually specify the files to preload.
|
|
39
|
-
|
|
40
|
-
You can specify an array of image files (`preload_images`) and an array of audio files (`preload_audio`) for preloading in the `jsPsych.init()` method. These files will load before the experiment starts.
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
// this trial will not preload the images, because the image file is being used
|
|
44
|
-
// in an HTML string
|
|
45
|
-
var trial = {
|
|
46
|
-
type: 'html-keyboard-response',
|
|
47
|
-
stimulus: '<img src="img/file1.png"></img>',
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
var audio_trial = {
|
|
51
|
-
type: 'audio-keyboard-response',
|
|
52
|
-
stimulus: function() { return 'audio/foo.mp3' }
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var video_timline = {
|
|
56
|
-
timeline: [
|
|
57
|
-
{
|
|
58
|
-
type: 'video',
|
|
59
|
-
stimulus: jsPsych.timelineVariable('video')
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
timeline_variables: [
|
|
63
|
-
{video: ['video/1.mp4']},
|
|
64
|
-
{video: ['video/2.mp4']}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// an array of paths to images that need to be loaded
|
|
69
|
-
var images = ['img/file1.png'];
|
|
70
|
-
var audio = ['audio/foo.mp3'];
|
|
71
|
-
var video = ['video/1.mp4', 'video/2.mp4'];
|
|
72
|
-
|
|
73
|
-
jsPsych.init({
|
|
74
|
-
timeline: [trial],
|
|
75
|
-
preload_audio: audio,
|
|
76
|
-
preload_images: images,
|
|
77
|
-
preload_video: video
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Preloading progress bar
|
|
83
|
-
|
|
84
|
-
By default, jsPsych will display a small progress bar while files are being preloaded. This progress bar represents all files that are being automatically preloaded or preloaded from the `preload_audio`, `preload_video`, and `preload_images` arrays. You may wish to turn this off if you are only loading a small number of files, as it will disappear so quickly that the participant may be confused about what it was. You can control whether the preloading progress bar appears by setting the `show_preload_progress_bar` parameter in `jsPsych.init()`
|
|
85
|
-
|
|
86
|
-
```javascript
|
|
87
|
-
jsPsych.init({
|
|
88
|
-
timeline: timeline,
|
|
89
|
-
show_preload_progress_bar: false // hide preload progress bar
|
|
90
|
-
});
|
|
91
|
-
```
|
package/docs/overview/mturk.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# Integrating with Mechanical Turk
|
|
2
|
-
|
|
3
|
-
A common use of jsPsych is to build an online experiment and find subjects using [Mechanical Turk](http://www.mturk.com/). Once an experiment is available through a web server and data is being [saved on the server](data.md), connecting the experiment with Mechanical Turk takes only a few additional steps. jsPsych has some built-in functionality to assist with this process.
|
|
4
|
-
|
|
5
|
-
## The jsPsych.turk module
|
|
6
|
-
|
|
7
|
-
The [jsPsych.turk](../core_library/jspsych-turk.md) module contains functions that are relevant for experiments running on Mechanical Turk.
|
|
8
|
-
|
|
9
|
-
## Creating an advertisement page
|
|
10
|
-
|
|
11
|
-
When potential subjects view your experiment on Mechanical Turk, they will be able to see a single webpage before deciding whether or not to accept the HIT (start the experiment). This first page is often used as an advertisement for the experiment, similar to posting a flier in a department hallway. The important thing to remember about this page is that potential subjects will be able to interact with it even if they haven't accepted the HIT. Therefore, it can be useful to change the content of the page depending on whether the HIT has been accepted or not. This is relatively easy to do:
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<div id="experiment_link">You must accept the HIT to begin the experiment</div>.
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
// jsPsych has a method turkInfo() which can determine whether or not the
|
|
18
|
-
// HIT has been accepted.
|
|
19
|
-
var turkInfo = jsPsych.turkInfo();
|
|
20
|
-
|
|
21
|
-
// turkInfo.previewMode is true in two cases: when the HIT has not been
|
|
22
|
-
// accepted yet OR when the page is viewed outside of mechanical turk.
|
|
23
|
-
// The second property, outsideTurk, is true when the page is viewed
|
|
24
|
-
// outside of mechanical turk, so together, the statement will be true
|
|
25
|
-
// only when in Turk and when the HIT is not accepted yet.
|
|
26
|
-
if(!turkInfo.previewMode && !turkInfo.outsideTurk) {
|
|
27
|
-
document.querySelector('#experiment_link').innerHMTL = '<a href="link_to_experiment.html" target="_blank">Click Here to Start Experiment</a>';
|
|
28
|
-
}
|
|
29
|
-
</script>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
One important issue with advertisement pages is that they must be served using the https protocol, which requires having an SSL certificate on the web server hosting the page. Instructions for how to do this vary depending on what kind of server you are using, so the best advice is to simply Google for instructions on how to acquire and install an SSL certificate on your particular server.
|
|
33
|
-
|
|
34
|
-
## Getting the worker ID
|
|
35
|
-
|
|
36
|
-
Every account on Mechanical Turk is given a unique identification string. Recording this ID is a useful way to keep track of who is doing your experiment. In particular, while Turk has built in tools for preventing the same person from doing a HIT more than once, there may be cases where you don't want subjects to complete related experiments. If you store the worker ID of every person who starts an experiment in a database, then you can exclude people by running a query on the database to check for the ID. jsPsych can get the workerID, assignmentID, and hitID with the turkInfo method.
|
|
37
|
-
|
|
38
|
-
```javascript
|
|
39
|
-
var turkInfo = jsPsych.turk.turkInfo();
|
|
40
|
-
|
|
41
|
-
// workerID
|
|
42
|
-
turkInfo.workerId
|
|
43
|
-
|
|
44
|
-
// hitID
|
|
45
|
-
turkInfo.hitId
|
|
46
|
-
|
|
47
|
-
// assignmentID
|
|
48
|
-
turkInfo.assignmentId
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Recording the workerId at the start of the experiment is also a good way to track dropouts.
|
|
52
|
-
|
|
53
|
-
## Submitting results to Mechanical Turk
|
|
54
|
-
|
|
55
|
-
If you are running a HIT on Mechanical Turk using the ExternalQuestion template, then you'll need to provide a way for subjects to indicate that they have completed the HIT. (If you are using another template, then the template will provide this code for you). jsPSych makes this a relatively easy task. A common strategy for external HITs is to display an HTML page on the Mechanical Turk website that links to your HIT. Subjects click the link, which opens the actual experiment content in a new browser window or tab, allowing the experiment to take up the whole browser window instead of just the iframe that displays content on Mechanical Turk.
|
|
56
|
-
|
|
57
|
-
On this page, you might include a submit button for workers to indicate that they have finished the experiment. The page would look something like this:
|
|
58
|
-
|
|
59
|
-
```html
|
|
60
|
-
<p>Enter the code you were given:</p>
|
|
61
|
-
<input type="text" id="code"></input>
|
|
62
|
-
<button onclick="sendData();">Submit HIT</button>
|
|
63
|
-
|
|
64
|
-
<script>
|
|
65
|
-
function sendData() {
|
|
66
|
-
jsPsych.turk.submitToTurk({
|
|
67
|
-
code: document.getElementById('code').value
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
</script>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
When workers click the button, the contents of the `code` text field will be sent to Mechanical Turk, and you'll be able to view the subjects and the codes that they entered in the Mechanical Turk GUI. You can then approve or reject work using the Mechanical Turk website.
|
|
74
|
-
|
|
75
|
-
## Limitations
|
|
76
|
-
|
|
77
|
-
jsPsych is not designed to communicate with the Mechanical Turk API in a comprehensive manner. If you are looking for software to help you post and manage HITs, then you may want to look at [PsiTurk](http://www.psiturk.org). jsPsych and PsiTurk complement each other nicely, and there is [an example of combining the two platforms](https://psiturk.org/ee/W4v3TPAsiD6FUVY8PDyajH) on PsiTurk's experiment exchange.
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# Automatic Progress Bar
|
|
2
|
-
|
|
3
|
-
jsPsych can show a progress bar at the top of the experiment page indicating the subject's overall completion progress. The progress bar is rendered outside the jsPsych display element, and it requires the `jspsych.css` file to be loaded on the page. As of version 6.0, the progress bar looks like this:
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
To show the progress bar, set the `show_progress_bar` option in `jsPsych.init` to `true`:
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
jsPsych.init({
|
|
11
|
-
timeline: exp,
|
|
12
|
-
show_progress_bar: true
|
|
13
|
-
});
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
The progress bar updates after every node on the top-level timeline updates. This avoids distracting updates in the middle of trials that are composed of multiple plugins, or confusing updates due to looping or conditional structures that may or may not execute depending on the actions of the subject. This also allows some flexibility for the programmer; by nesting timelines in a deliberate manner, the timing of progress bar updates can be controlled.
|
|
17
|
-
|
|
18
|
-
## Manual Control
|
|
19
|
-
|
|
20
|
-
The progress bar can also be manually controlled using the function `jsPsych.setProgressBar()`. This function takes a numeric value between 0 and 1, representing the proportion of the progress bar to fill.
|
|
21
|
-
|
|
22
|
-
```js
|
|
23
|
-
var trial = {
|
|
24
|
-
type: 'html-keyboard-response',
|
|
25
|
-
stimulus: 'Almost done...',
|
|
26
|
-
on_finish: function(){
|
|
27
|
-
jsPsych.setProgressBar(0.85); // set progress bar to 85% full.
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
You can also get the current value of the progress bar with `jsPsych.getProgressBarCompleted()`.
|
|
33
|
-
|
|
34
|
-
```js
|
|
35
|
-
var proportion_complete = jsPsych.getProgressBarCompleted();
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If you are going to use manual progress bar control, you may want to disable the automatic progress bar updates by setting the `auto_update_progress_bar` property in `jsPsych.init()` to `false`.
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
jsPsych.init({
|
|
42
|
-
timeline: exp,
|
|
43
|
-
show_progress_bar: true,
|
|
44
|
-
auto_update_progress_bar: false
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Here's a complete example showing how to use these functions and `jsPsych.init()` settings to manually update the progress bar:
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
var n_trials = 5;
|
|
52
|
-
|
|
53
|
-
var start = {
|
|
54
|
-
type: 'html-keyboard-response',
|
|
55
|
-
stimulus: 'Press any key to start!',
|
|
56
|
-
on_start: function() {
|
|
57
|
-
// set progress bar to 0 at the start of experiment
|
|
58
|
-
jsPsych.setProgressBar(0);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var trial = {
|
|
63
|
-
type: 'html-keyboard-response',
|
|
64
|
-
stimulus: 'This is a trial!',
|
|
65
|
-
on_finish: function() {
|
|
66
|
-
// at the end of each trial, update the progress bar
|
|
67
|
-
// based on the current value and the proportion to update for each trial
|
|
68
|
-
var curr_progress_bar_value = jsPsych.getProgressBarCompleted();
|
|
69
|
-
jsPsych.setProgressBar(curr_progress_bar_value + (1/n_trials));
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
var trials = {
|
|
74
|
-
timeline: [trial],
|
|
75
|
-
repetitions: n_trials
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
var done = {
|
|
79
|
-
type: 'html-keyboard-response',
|
|
80
|
-
stimulus: 'Done!'
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
jsPsych.init({
|
|
84
|
-
timeline: [start, trials, done],
|
|
85
|
-
show_progress_bar: true,
|
|
86
|
-
auto_update_progress_bar: false
|
|
87
|
-
});
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Custom Text
|
|
91
|
-
|
|
92
|
-
By default, jsPsych adds the text "Completion Progress" to the left of the progress bar. You can specify custom text using the `message_progress_bar` parameter in `jsPsych.init`.
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
// support for different spoken languages
|
|
96
|
-
jsPsych.init({
|
|
97
|
-
timeline: [...],
|
|
98
|
-
show_progress_bar: true,
|
|
99
|
-
message_progress_bar: 'Porcentaje completo'
|
|
100
|
-
});
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
// no message
|
|
105
|
-
jsPsych.init({
|
|
106
|
-
timeline: [...],
|
|
107
|
-
show_progress_bar: true,
|
|
108
|
-
message_progress_bar: ''
|
|
109
|
-
});
|
|
110
|
-
```
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Record browser interactions
|
|
2
|
-
|
|
3
|
-
Participants in an online experiment have the freedom to multitask while performing an experiment. jsPsych automatically records information about when the user clicks on a window that is not the experiment, and about when the user exits full screen mode if the experiment is running in full screen mode. This data is stored separately from the main experiment data, and can be accessed with [jsPsych.data.getInteractionData()](../core_library/jspsych-data.md#jspsychdatagetinteractiondata).
|
|
4
|
-
|
|
5
|
-
Each time the user leaves the experiment window, returns to the experiment window, exits full screen mode, or enters full screen mode, the event is recorded in the interaction data. Each event has the following structure.
|
|
6
|
-
|
|
7
|
-
```javascript
|
|
8
|
-
{
|
|
9
|
-
event: 'focus', // 'focus' or 'blur' or 'fullscreenenter' or 'fullscreenexit'
|
|
10
|
-
trial: 12, // the index of the active trial when the event happened
|
|
11
|
-
time: 1240543 // time in ms since the start of the experiment
|
|
12
|
-
}
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
You can specify a custom function, in the jsPsych.init() method, that is called whenever one of these events occurs
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
jsPsych.init({
|
|
19
|
-
on_interaction_data_update: function(data) {
|
|
20
|
-
console.log(JSON.stringify(data))
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
```
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Running Experiments
|
|
2
|
-
|
|
3
|
-
You can run your jsPsych experiment:
|
|
4
|
-
|
|
5
|
-
* **offline**, by opening the HTML file directly in the browser using the `file://` protocol
|
|
6
|
-
|
|
7
|
-
* **online**, by hosting the files on a web server using the `http://` or `https://` protocol
|
|
8
|
-
|
|
9
|
-
The way that you run your experiment will have consequences for certain aspects about how the experiment works, and what your experiment will be able to do. This page explains what you need to know about both of these options.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Offline
|
|
14
|
-
|
|
15
|
-
You can run your jsPsych experiment offline by opening the HTML file directly in a web browser, for instance by double-clicking on it. This uses the `file://` protocol. It's usually the fastest and easiest way to run through an experiment, and is very useful while writing and testing the code.
|
|
16
|
-
|
|
17
|
-
At some point you will need to move your experiment files onto a server and send the data to a database, since this is how you will ultimately collect the data (unless you're planning to collect data on your local computer). There are some important differences between the way the experiment runs offline compared to online via a web server.
|
|
18
|
-
|
|
19
|
-
Note that, unless noted, here we're using the word "server" to mean either a _local_ server (which runs on your computer and only makes the experiment files available from within that computer, and is often used during development), or a _remote_ server (which does not run on your computer and does share your experiment files over the internet).
|
|
20
|
-
|
|
21
|
-
### Cross-origin requests (CORS) and safe mode
|
|
22
|
-
|
|
23
|
-
Web browsers have a security policy called [cross-origin resource sharing (CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) that determines whether the webpage can request files that come from a different origin (i.e. protocol, host/domain, and port). This isn't a problem when your study runs _online_, because in that case your experiment files all have the same origin. However, when you run your experiment _offline_, the CORS policy blocks some jsPsych features that require [loading local files](https://security.stackexchange.com/questions/190266/why-chrome-blocks-ajax-locally/190321#190321). If your experiment uses these features, then [CORS errors](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors) will prevent the experiment from running.
|
|
24
|
-
|
|
25
|
-
To prevent these errors, jsPsych uses a 'safe mode' when it detects that the HTML page is running via the `file://` protocol, and if so, automatically disables the features that don't work in that context. Specifically, when a jsPsych experiment runs offline:
|
|
26
|
-
|
|
27
|
-
* **Web Audio is disabled** (even if `use_webaudio` is set to `true` in `jsPsych.init`). The WebAudio API option is used by default because it allows more precise measurement of response times relative to the onset of the audio. But because WebAudio doesn't work offline, audio will be played using HTML5 audio instead. This is equivalent to setting `use_webaudio` to `false` in `jsPsych.init`.
|
|
28
|
-
* **Video preloading is disabled** (both automatic preloading via plugins, and manual preloading via `preload_video` in `jsPsych.init`). Videos will still play when you run your experiment offline, but they will load _during_ the experiment, which might cause noticeable delays before video playback starts.
|
|
29
|
-
|
|
30
|
-
This safe mode feature is controlled by the `override_safe_mode` parameter in [`jsPsych.init`](../core_library/jspsych-core.md#jspsychinit), which defaults to `false`. If you leave this setting as the default, then you won't need to worry about CORS errors while running your experiment offline, or remembering to change your `jsPsych.init` settings when you move the experiment online.
|
|
31
|
-
|
|
32
|
-
It's possible to override jsPsych's safe mode by setting `override_safe_mode` to `true` in `jsPsych.init`. One reason you might do this is if you've disabled web security features in your browser (see [here](https://alfilatov.com/posts/run-chrome-without-cors/) and [here](https://stackoverflow.com/questions/4819060/allow-google-chrome-to-use-xmlhttprequest-to-load-a-url-from-a-local-file) for instructions in Chrome), which is safe to do if you know what you're doing. If your experiment does not use Web Audio or preloaded videos, then jsPsych's safe mode feature will not have any effect.
|
|
33
|
-
|
|
34
|
-
The `override_safe_mode` parameter also has no effect when your experiment is running online a web server, because the page will be loaded via the `http://` or `https://` protocol.
|
|
35
|
-
|
|
36
|
-
### Media loading
|
|
37
|
-
|
|
38
|
-
While running your experiment offline, any media files are likely to load very quickly because they are stored on your own computer's disk. Therefore you may not notice problems with file loading delays while running your experiment locally (either offline or on a _local_ server) because the files will load fast enough that they never cause disruption. However, when your experiment is hosted on a _remote_ server, the files will need to be transferred over the internet, which means they will take longer to load - in some cases much longer. Loading delays are most noticeable with media files: images, audio, and video. As explained on the [Media Preloading](media-preloading.md) page, loading delays during your experiment can cause problems for stimulus display and response times.
|
|
39
|
-
|
|
40
|
-
It is important to test your experiment to ensure that any media files are preloading successfully and not being requested again during the experiment. You can use the Network tab in your browser's developer tools to see when files are loaded and to simulate a slow internet connection (see [here](https://developers.google.com/web/tools/chrome-devtools/network) for Chrome Network tab documentation). If you are preloading many and/or large files, such as videos, you may want to increase the `max_load_time` parameter in [`jsPsych.init`](../core_library/jspsych-core.md#jspsychinit) so that participants with slow/unreliable internet connections will be able to take part in your experiment.
|
|
41
|
-
|
|
42
|
-
### Permanent data storage
|
|
43
|
-
|
|
44
|
-
As explained in the [Data Storage, Aggregation, and Manipulation](data.md#data-in-jspsych-permanent-and-non-permanent-data) page, jsPsych stores information in the participant's browser. While running an experiment offline, you won't be able to send the data to a database. However you can still see the data that jsPsych collects by saving it as a local file (using [`jsPsych.data.get().localSave`](../core_library/jspsych-data.md#localsave)), displaying it in the webpage at the end of the experiment (using [`jsPsych.data.displayData`](../core_library/jspsych-data.md#jspsychdatadisplaydata)), or printing it to the browser's console (using [`console.log`](https://www.w3schools.com/jsref/met_console_log.asp)).
|
|
45
|
-
|
|
46
|
-
Permanent data storage is also necessary when the code that runs the experiment depends on information that can't be known in advance, and that changes throughout data collection. Some common examples of this in cognitive behavioral research are **version counterbalancing**, where the experiment code needs to access and update the history of version assignment in order to determine which version should be assigned, and **multi-session/training studies**, where the experiment might need to access and update information about each participant like their current session number, task difficulty level, etc.
|
|
47
|
-
|
|
48
|
-
Doing these things in an automated way requires the use of a server. While developing and testing your experiment offline, you might choose to simulate some of these things and then implement them properly once you move your experiment online. For instance, you could [randomize](../core_library/jspsych-randomization.md#jspsychrandomizationsamplewithoutreplacement) instead of counterbalancing version assignment:
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
var versions = [1,2];
|
|
52
|
-
var random_version = jsPsych.randomization.sampleWithoutReplacement(versions,1)[0];
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
And use [URL query parameters](../core_library/jspsych-data.md#jspsychdatageturlvariable) to pass in variables like session number and difficulty level:
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
// add the variables onto the end of the URL that appears in the browser when you open the file
|
|
59
|
-
// e.g., file:///C:/my_experiment.html?id=1&sess=2&diff=3
|
|
60
|
-
var participant_id = jsPsych.data.getURLVariable('id');
|
|
61
|
-
var session = jsPsych.data.getURLVariable('sess');
|
|
62
|
-
var difficulty = jsPsych.data.getURLVariable('diff');
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Online
|
|
70
|
-
|
|
71
|
-
### Hosting the Experiment and Saving the Data
|
|
72
|
-
|
|
73
|
-
jsPsych is a front-end JavaScript library that runs entirely on the participant's computer. To run a jsPsych experiment over the internet, the files need to be hosted on a public web server so that participants can access the experiment using a web browser. When the participant completes the experiment in the browser, all of the data that jsPsych collects is stored on the participant's computer in the browser's memory. To get access to this data, it needs to be sent from the participant's browser back to the web server and stored in a database or a file.
|
|
74
|
-
|
|
75
|
-
To be maximally flexible, jsPsych doesn't provide a single built-in solution for the web server component of your experiment. This makes jsPsych compatible with a wide range of hosting services and tools, allowing researchers to choose the web server option that best suit their needs.
|
|
76
|
-
|
|
77
|
-
Some options for running your jsPsych experiment online include:
|
|
78
|
-
|
|
79
|
-
* [Cognition.run](https://www.cognition.run/) - A free service designed specifically for hosting jsPsych experiments, with an easy-to-use interface.
|
|
80
|
-
* [JATOS](https://www.jatos.org/Whats-JATOS.html) - A free program that runs on your own server and provides a GUI for setting up experiments and accessing the data. Offers lots of features for creating more complex experiments and managing multiple researchers.
|
|
81
|
-
* [Pavlovia](https://pavlovia.org/) - A paid hosting service for web-based experiments, run by the PsychoPy team. Experiment files are managed on a GitLab repository. Participants will access the experiment through a link to Pavlovia.
|
|
82
|
-
* [PsiTurk](https://psiturk.org/) - Python-based program to help you host your experiment on your own computer and collect data from MTurk (see Recruiting Participants below). Relatively easy for a DIY option.
|
|
83
|
-
* [Pushkin](https://languagelearninglab.gitbook.io/pushkin/) - A set of tools to help you set up your own virtual laboratory for online experiments. This option differs from the others in that it helps you set up a complete website that may contain many different experiments, information about the laboratory, participant logins, and other features that are targeted at hosting large-scale data collection efforts.
|
|
84
|
-
* Full DIY - You can setup your own web server and database and handle the communication yourself. Traditional web server 'stacks' include [LAMP](https://www.digitalocean.com/community/tutorial_collections/how-to-install-lamp)/[LEMP](https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-20-04) (Linux operating system, Apache or Nginx server application, MySQL database, and PHP programming language). Other common web server frameworks include [Flask](https://flask.palletsprojects.com/) (Python) and [Node.js](https://nodejs.org/) (JavaScript).
|
|
85
|
-
|
|
86
|
-
### Recruiting Participants
|
|
87
|
-
|
|
88
|
-
Once your experiment is running online, you could recruit participants in the same way that you would for lab-based studies. For instance, if your institution uses SONA, you can advertise your web-based study link on SONA. SONA allows you to automactically embed a unique ID in online study URLs, which you can then save in your data using [jsPsych's URL query parameters function](../core_library/jspsych-data.md#jspsychdatageturlvariable). SONA will also generate a completion URL that you can redirect participants to at the end of the study, and this will mark them as having completed the study in SONA.
|
|
89
|
-
|
|
90
|
-
To take full advantage of hosting an experiment online, many researchers advertise their experiments more widely. Social media and other media outlets provide one option for reaching a large number of potential participants. There are also some commercial platforms that you can use to advertise your study and pay anonymous online participants. These recruitment platforms charge a fee for use. The advantages of these platforms are that they handle the participant payments and allow you to specify pre-screening criteria. The most commonly used recruitment platforms in online behavioral research are:
|
|
91
|
-
|
|
92
|
-
* [Prolific](https://www.prolific.co/): An online labor market designed specifically for web-based research.
|
|
93
|
-
* [Amazon Mechanical Turk (MTurk)](https://www.mturk.com/): An online labor market designed for advertising paid 'human intelligence tasks'. This service was designed for use by commercial businesses but has been used by behavioral researchers for many years.
|
|
94
|
-
|
|
95
|
-
Like SONA, Prolific and MTurk use URL query parameters to get participant information, and redirection to specific URLs to mark participants as having finished the study. jsPsych includes [convenience functions for interacting with MTurk participants](../core_library/jspsych-turk.md). Information about integrating with Prolific can be found in the researcher support section of their website.
|