See a minimal working example at http://stanford.edu/~bwaldon/cgi-bin/afs_experiment/index.html
A PHP script (collectdata.php
) collects a participant's data and saves their results as a .json file on your web server. Participants enter some sort of identifying information (e.g. a name or a school ID), so you can keep track of them for compensation purposes. Note that this means you'll have to ensure that read permissions of your results
folder are restricted to just yourself and system admins.
One option for Stanford affiliates is the Andrew File System (AFS). See here about how to request AFS services at Stanford: https://uit.stanford.edu/service/afs
Should you choose to use AFS, you'll also need to enable the Stanford Common Gateway Interface (CGI) service. More on enabling CGI here: https://uit.stanford.edu/service/cgi
Hint: a nice feature about the 245B experiment templates is that you can preview the data that would be saved if your experiment were live. By default, your script won't do this - after a particpant completes the study, they're redirected to collectdata.php
(note that PHP won't work on a local machine - you'll probably just see raw code in your browser). If you want to preview your results and not redirect to the PHP script, open up _shared/js/mmturkey.js
and change line 116...
if (false) {
to:
if (true) {
Make sure to change this back to if (false) {
before going on to step 3.
Upload your experiment folder to the appropriate place provided by your web hosting service. For Stanford AFS users, this is the cgi-bin
directory (PHP won't work elsewhere on AFS).
node results/convertdata.js
- A less awkward way to preview data collection locally.