Link to redirect participants to Google forms questionnaire


I’m running an experiment online.
After participants finish their task in Pavlovia, I want to re-direct them to a Google forms link to fill-in a post-experimental questionnaire.

The hack I used is to insert a button in PsychoPy associated with the following code in Python:

import webbrowser“https://link would be here”, new=1)

In Javascript for Pavlovia, it is translated as:

import * as webbrowser from ‘webbrowser’;

And I receive an error:
"Unexpected token: * " ← referring to the import statement.

Any ideas on how I can do this for the online version in Pavlovia?
It works well in PsychoPy locally.


When using JavaScript you already have a web browser so there’s no need to import it.

(I’m pretty sure this is true. Check my crib sheet for confirmation)

Thanks, @wakecarter , this indeed is the case.

Small caveat (but will have to deal with it now):
In the window for the link, there is no translation from python to javascript so I can only remove the import statement from javascript.

Hence, I remove it altogether, compile the code for online JS use, but it will not work locally as the import statement is missing from Python and I get an error regarding that, as can be seen in the below image.

Buttons don’t yet work online.

In my case, after I remove the import statement in PsychoPy and re-compile to sync with web project, the online version works fine, as well as the button for online.

Once I click it, it automatically opens a new tab in Google Chrome going at the google forms (accessing the link from the button).

Hello, I am also running an experiment online. But I would like to present the Forms first and then direct the participants to the experiment in Pavlovia. Do you know a way this could work?
Thank you in advance @fmtoma @wakecarter

What I did was:

  1. Design questionnaire using Google forms
  2. At the end of the Google form, place the link to Pavlovia online experiment (that is running, not in piloting mode).
1 Like