How to integrate a Prolific redirect link onto Pavlovia directly

URL of experiment:

Description of the problem: Hi everyone! I have a question about how to integrate a Prolific redirect link onto Pavlovia directly (presumably using the javascript code). I am aware of the typical method of integrating the Prolific link in a Psychopy experiment (i.e., by clicking Settings > Online > and pasting the link generated by Prolific into “Completed URL” and then uploading the experiment to Pavlovia). However, my current experiment was largely developed using javascript code on Pavlovia (I only created the basic structure of the task on the Psychopy builder), and if I attempt to use the typical method of Prolific link integration then it will overwrite and essentially erase my code. Does anyone here know that proper way to handle this issue? Any guidance on this matter would be greatly appreciated!

Best wishes
Sam

Hi Sam,

I’d recommend creating a new project with only one routine plus a Prolific link. You could then inspect the JavaScript to work out what code you need to add to your real project.

1 Like

Thanks so much for your response! This worked very well.

Specifically, for future reference, Psychopy automatically generates a section of code in every experiment by which to place redirect links. If you go to your experiment’s javacode, click edit, press ctrl+F, and type “url”, you will be taken directly to this section of code (it is the only place in the code which contains any information about URLs). If your experiment is not associated with a redirect link, then the code will look like this:

// add info from the URL:
util.addInfoFromUrl(expInfo);

return Scheduler.Event.NEXT;
}

To add a redirect link directly into this code, you simply need to place a line of code underneath the first line, and paste your Prolific generated code twice (in the areas referenced as ‘LINK HERE’), as such:

// add info from the URL:
util.addInfoFromUrl(expInfo);
psychoJS.setRedirectUrls(‘LINK HERE’, ‘LINK HERE’);

return Scheduler.Event.NEXT;
}

This should do the trick!

2 Likes