psychopy.org | Reference | Downloads | Github

Using online experiment on own domain

Hey,

I tried to use an experiment that works on Pavlovia on my own domain. There it does not load the condition files and the images that are used in the experiment, at the beginning. Does anyone have an idea why that is the case?

Best regards

The PsychoJS code has to connect to a server script and configuration file in order to save data to the server etc and fetch files. Creating such scripts is not something we’re currently supporting - it’s only recommend for experts!

Hey Jon,

thank you for the answer! I would still like to try it. Could you just give me a very brief clue, how I could start to connect the PsychoJS code to a server script and a configuration file? I will find out the rest on myself but it would be great if you just tell me how it’s called or what I could google to do it. I thought it should be doable, since it worked in older versions. So maybe I could find some files in my older experiments, that I could adjust to the new experiment?

Big thanks in advance!

I guess I can help you with this as I am doing it myself right now for a study to be run in MTurk.

I’d recommend you first put all images and files you use under a new folder (I call it assets/). Then, whenever you export your code into html, make sure you copy your original assets folder under resources/ because not all contents are exported if you leave it as is (i.e, images).

After you do that, you should put that file into any web page you have and access it from anywhere. You might have the following issues:

  • As a PsychoPy2 user, I had to fix strings in the instructions texts (from u’text’ to ‘text’).

Also make sure you use the developer toolbox (in Chrome or Firefox) and use the console.log(var) / debugger trick. You basically test the code by printing what are the values of the different variables using console.log(x) where x is your variable, but also you can write debugger anywhere in your code which is much more powerful and let you use the “console” right from the debugger point.

Hi kantarev,

I have tried the same thing with PsychoPy Builder (ver. 3.0.7) a few weeks ago.
I succeeded in running my experiment program on GitHub Pages, connecting to the Pavlovia server.

Notice: It has not been confirmed that this method works with the latest version.

I’ll give you some pieces of advice for running an online experiment on the GitHub Pages, however, I think this method no longer works well now…

To get configure file for your experiment:
1. Go to “https://run.pavlovia.org/'your name’/‘your experiment name’/html/config.json”.
2. Then, you can find the script of the configure file (config.json). Copy and Paste it to script (text) editor and save as “config.json”.
3. Place the configure file under the “html” folder.

To create a static home page on GitHub Pages:
1. Go to “https://pages.github.com/” and create a repository for a static home page.
2. Git clone and git push your online experiment files (“html” folder).
3. Go to GitHub Pages section in the repository setting and the choose a source repository.

I guess that we cannot separate our online experiment workflow from the Pavlovia server because our online experiments depend on the PsychoJS Manager running on the Pavlovia server side.

Good luck.