How to provide return link in jsPsych for participants recruited through prolific?

I have not found any documentation on how to provide a completion return link to Prolific using jsPsych and the Pavlovia plugin. My issue is that I don’t know what does the Pavlovia script do at the end of a jsPsych experiment. Is it okay to redirect inside the on_finish function?

...
let pavlovia_finish = {
        type: "pavlovia",
        command: "finish"
    };
    timeline.push(pavlovia_finish);

jsPsych.init({
        timeline: timeline,
        on_finish: function () {
            location.href="returnlink.html" // Real link would go here
        }
    })

bump

@apitiot is there a way to provide completion URL to the jsPsych plugin?

Update: Someone suggested to me to simply add a new trial with the return link after the pavlovia_finish trial, is this alright? Or will it cause any problems with Pavlovia?

No, the concern is that the data get saved after the trials finish and the forwarding URL needs to come after that. If you forward out of the experiment in a trial then the trials haven’t ended and the data will not be saved (is my guess)

That was/is my concert as well, although I did not test it. Instead I decided to forward participants to the url after the end of the experiment, following a 10sec timeout. It worked, but it feels hackish…

jsPsych.init({
            timeline: timeline,
            on_finish: function () {                
                document.body.innerHTML = '<p> Please wait. You will be redirected back to Prolific in a few moments.</p>'
                setTimeout(function () { location.href = "https://app.prolific.co/submissions/complete?cc=XXXXXX" }, 10000)
            }
        })
2 Likes

I am having a similar problem (although with jsPsych and our participant-recruiting system SONA). Is there an official solution yet?