Getting SONA survey code from URL query string

I’m recruiting subjects on Sona. Sona tells me that if I include the SURVEY_CODE into the URL as a query string I can make use of the unique ID associated with each Sona subject to verify experiment completion. I’ve written my study with JsPsych. The URL looks like this:

https://run.pavlovia.org/<user>/<task_name>?participant=%SURVEY_CODE%

I was wondering if anyone knows how I can use the query string within my script. The psychopy documentation page on Sona integration is empty and Sona’s version of the instructions seem outdated. At least, there isn’t the option to change the Completed URL field for my set up.

In what way do you think that Sona’s information is outdated. It looks fine to me.

To access participant in PsychoPy you use expInfo['participant'] but I don’t know abot jsPsych

I suppose I shouldn’t have said outdated. The Sona instructions are for PsychoPy only, so the settings window that it tells you to use isn’t available for me. If anyone knows how to do this on JsPsych I’d really appreciate it!

Okay this code seems to work for JsPsych.

    const searchParams = new URLSearchParams(window.location.search);
    const participant = searchParams.get("participant");
    console.log({ participant })