psychopy.org | Reference | Downloads | Github

Providing feedback

Hey there,

my lab is very much looking forward to the new online option!
I know that it is still under development, but we still want to try it in a pilot study in February/2018.
Since participants will be running the experiment on their own, it would be very helpful if we could provide feedback as described here: http://www.psychopy.org/recipes/builderFeedback.html
I’m aware that the code component is not available for online experiments yet, but maybe anybody knows a work-around, as in adding some code to the index.html file? Or maybe you already have a beta version that we could try?

My understanding is:

Yes, you would need to edit that file yourself. The relevant code would be Javascript rather than Python, so there won’t be much expertise on this forum to help you with that.

No. A commercial company has recently started the next round of development on the online experiment capability but it is not ready to release yet, even in beta form.

I’ve figured out how to do it by adding code to the index.html file. Thankfully it’s not too complicated - I don’t have experience with Javascript myself.

Here’s my solution:

  1. In Builder, insert routine with text stimulus where you want your feedback to be presented (just as you would normally do, but do NOT add a code component to the routine). Add a variable (e.g. $feedback_message) as text to the text component and ‘set every repeat’.

  2. When you’ve exported the experiment, open the index.html file in a text editor.

  3. Search (cmd + F) for your variable (feedback_message). You should get to a line saying

// update component parameters for each repeat
feedback_text.setText(feedback_message);


Note that if you forgot to ‘set every repeat’, you would have to add the

feedback_text.setText(feedback_message);

line yourself. You would also have to jump to the section where your feedback routine is initialized and change text to:

text : ‘default text’


  1. Just above this line, add your code (what you would write in your code component), e.g.:

number_correct = key_upper_left.corr + key_upper_right.corr;
feedback_message = number_correct + ’ of 4 numbers correct’;

As Michael noted, code needs to be written in Javascript.

1 Like