I recommend that you do not tackle this without the aid of someone who understands web servers.
Once you have your experiment working on your own computer you may want to move some part of it to the web. There are two parts of it that can be moved, and they can be moved independently: you can move one to the web and leave the other, or move them both.
Putting your script and stimuli on a web server means you, or other people can run the experiment on any computer/device with a working web browser. PsyScript experiments will even work on small devices like a smartphone, with a few restrictions due to things that such devices cannot or will not do for security reasons.
Collecting results using a web server means that instead of the log of a session being held inside the device the experiment was run on, the log is sent to a web server. A program running on the web server can then store that log away in a text file ready for you or someone else to read. All results from everyone running that experiment can be stored in one big log file, ready for import into Excel or SPSS whenver you want. It is not possible for someone running the experiment to figure out the log file's location just by looking at the files involved in the experiment. You can keep that a secret.
The move I've described first is the simpler of the two, and it provides some testing for the one I describe second.
You think you have all the above ? Test it before continuing. Make sure you know how to do those things. Copy a new page onto your web server and make sure people can see it in their web browsers.
I recommend that you do not tackle this without the aid of someone who understands how to run a web-facing application on a web server.
In order to collect results using a web server you need to be able to not just put static pages on a web server but also to be able to run programs on your web server.
I've provided a working example of such a program – saveALog.php – written in PHP, the most well known server-side programming language. This program is available for download, and an example is running on our own server for your use for testing purposes.
If your web server can run PHP programs (the most commonly used ones can) then you can use my example just as it is or modify it to work the way you want. My own example runs on both the most up-to-date and also some old versions of PHP.
You can also replace my program entirely with another written in PHP or any other language your web server supports. This documentation explains the protocol used.
Once you have your experiment working on your computer you have a folder with the script and some stimuli in it. Putting that material on your web server involves a few steps.
Warning: For steps 1 and 2 don't put one of those folders inside the other. This can create access problems later. You can create one folder and put both folders inside that one if you like.
file://
URL.Once you've done this, pointing a browser at the 'experiment.html' file in the 'editor' folder will allow your participants to run an experiment in their browser.
The online experiment program looks for three textblocks with special names in your experiment script: 'Title', 'Brief' and 'Debrief', and shows these at appropriate times before and after running the experiment. You might want to put dummy text in these blocks to see how they work, then correct the text to something more appropriate.
Collection of the session log is controlled by the define logMethod
line in your script. Normally this will read
define logMethod localStorage
which tells psyScript to supply logs to whatever browser you're running. However you can instead define the logMethod to be something like
define logMethod [URL] [key]
for example
define logMethod https://open.psych.lancs.ac.uk/software/PsyScript3/saveALog.php test2
The URL is the URL of a web page to send the log to. The key is a string you can send to that web page with your log. It can be used to tell that web page how to file the log. For example, to tell the web page which experiment the log was generated by, or which participant pool of subjects your participant was from. PsyScript sends the key and log as object properties 'theDestKey' and 'theLog' in JSON-formatted POST data which looks like the following:
{"theDestKey": "test2",
"theLog": "\tthis is the first logged item\tthis is the second logged item",
"thePath": "https://open.psych.lancs.ac.uk/software/PsyScript3/projects/test%20scripts/"}
An example PHP application called saveALog.php
is available and can be downloaded from the PsyScript homepage. It accepts the POST data and writes the log away to a file on disk indicated by the 'theDestKey' parameter. This PHP application uses the 'key' supplied to specify a file on disk to append the new log information to.
You may want to make sure that the contents of the experiment log is kept private. If you use HTTPS in your logMethod URL (as is used in the above example), then the data will be sent from the experiment device to the server in an encrypted form. You can, of course, only do this is the server you're using supports HTTPS and has an appropriate certificate. If you don't understand these issues, consult someone who is familiar with web server technology.