| Reference | Downloads | Github

CompletedURL / IncompleteURL

I am trying to do approximately the same. At the end of my experiment, the participants have to answer some questions in Qualtrics (I have a so called anonymous link) but I want to link the answers from qualtrics to the appropriate experiment participant/data and I don’t know how… I tried this:

$“url/” + expInfo[‘participant’]

but this doesn’t work.

If I add the link in “completed url” without the “+…” it works but it doesn’t help to link the two together.

@aelreym did you literally write “url/” in the field though? David is suggesting that you insert your (qualtrics) URL into that location, and there’s probably some character at the end that Qualtrics expects, beginning with a ?
So it might be something like

$"" + expInfo['participant']

What this achieves is appending the participant value onto the end of the url. Did you try that? Do you know the url that your study is expecting (and what qualtrics calls its subject identifier)?

Yes I inserted the Qualtrics URL of my questionnaire so this works well:


But as soon as I add + expInfo['participant'] the link gets inactive and it shows me “not found”.
I am looking for something like this so that I can link the answers from qualtrics to the participant results’ of my experiment in Pavlovia.

Did you forget the ? before subjectID

This works great for me - thanks! I have one question though: can I also use a variable that was generated later in the experiment and not in the dialogue box and if so how would I do that?

If I use a variable called “randomID” like this:

$“” + randomID

or this:

$“” + expInfo[randomID]

it doesn’t work. The url is appended with “undefined”

I can add it to my result file with psychoJS.experiment.addData(‘randomID’, randomID) though, that is working just fine. So accessing the variable during the experiment is not a problem.

1 Like

`“” + $randomID

This is the same way you format a text component.

1 Like

Thanks @doerte for the question! I have a similar issue:

I would like to generate the completedURL depending on the responses in the task. For example, forward all participants with a certain accuracy level to either urlA or urlB. Basically, something like this:

if accuracy >= 0.5:
    my_url = “” + "good"
elif accuracy < 0.5:
    my_url = “” + "bad"

Then, in the experiment settings, I would set completedURL to $my_url.

Does not work for me though. Like @doerte, I think it’s due to the fact that my_url is only created towards the end of the experiment? Any hints? Thanks!

How about setting my_url to just “good” or “bad” and then using

"" + $my_url


Yes, I could try that but just realized I was unspecific. In my case I would set two completely different URLs. More like:

if accuracy >= 0.5:
    my_url = “/completely_unique_url_A”
elif accuracy < 0.5:
    my_url = “/totally_different_url_B”

and then set completedURL in the experiment settings to $my_url.

So the URLs are completely different and I can’t just append a variable like an ID.

Thanks for your idea. Unfortunately that didn’t work for me, because in the js the variable was still created after the redirect link was set. I just moved the generation of the random code to an earlier point in the .js directly. That fixed the problem for me. This of course wouldn’t work for something as @lnnrtwttkhn is looking for where the URL actually depends on the performance in the task.

1 Like

So did it need to be in a Begin Experiment block?

No, that’s where I had it initially. But this was still “too late” as the redirect link is established very early on in the .js file. I manually edited the .js after doing everything else in Builder first.

Thanks for the clarification – so basically it can only take expInfo variables, not ones created during the experiment.

Yes, the issue is that the call to redirect to this URL is pre-scheduled at the top of the study and, at that point, your variable doesn’t exist.

There is a function in psychojs setRedirectUrls that you could use though in a code component. I think you’d just need to add something like this to your study after you’ve chosen the URL the redirect should point to:

PsychoJS.setRedirectUrls(myCompletedURL, myCancelledURL)

Note that this function doesn’t perform the redirect. It simply determines where to go later, whenever the study ends


Just a minor comment: It should be
psychoJS.setRedirectUrls(myCompletedURL, myCancelledURL)

starting with a small letter. I tried and after I changed this everything works like a charm now, so thank you @jon for this solution!

1 Like

Hi Jon,

Since I do not have access to Qualtrics, I want to redirect the participants to a google form at the end of my Pavlovia experiment. I followed the above method and put this in the completionURL tab of online experiment in PsyhoPy:
$“” + expInfo[‘Participant’]

When I try to run this on Pavlovia, I get this message : Dynamic Link Not Found.
(The URL works fine as long as the + expInfo[‘Participant’] is not added.)

Please tell me if I am doing anything wrong here?

You are missing the ?varname= at the end of the static part of the URL


I am sorry to ask this but what exactly is the ‘varname’ here? Is it the field in the google forms that refers to the subject’s identity?

I set the completionURL to this:
$“” + expInfo[‘Participant’],
where subject ID is a field in google form and participant a field in the Pavlovia dialog box. The link works just fine now. But, how do I trace this participant id as a subject’s identity in my google form response sheet?

Off the top of my head, I’m not sure whether Google forms can read URL variables. You’ll need to Google that to check.

So it looks like the google forms cannot read URL variables. In that case, is there any other way to work around the issue of matching identities in pavlovia and google forms?
For example, asking the participants to fill their IDs in forms assigned to them in pavlovia (if that happens) or collecting mail ids on both platforms?

These are just some things on top off my head. Could you please suggest a more streamlined solution?