psychopy.org | Reference | Downloads | Github

CompletedURL / IncompleteURL

Just a quick question.

What’s the deal with the completedURL and incompleteURL. I noticed that after I finish an experiment online, my browser is directed to a website called completedURL if I finished and the other one if the experiment wasn’t completed. Are we able to customize what page participants are directed to yet? Or is this the foundation of a feature that isn’t completed yet?

1 Like

Hi @unagi_pie, yes the idea is that when participants from a recruirment service, such as Prolific, take part in online your experiment, they can be redirected upon completion of your task using your “CompletedURL” address where they can be rewarded. Participants who fail to complete can be redirected to the IncompleteURL address.

Thanks @dvbridges. So, is there a way for me to set a CompletedURL? Ideally, I’d like the redirect participants who have completed the experiment to a page where they can fill out a questionnaire. Is this possible?

Yes you should find the parameters in the online tab of your experiment settings.

1 Like

Hi,

can the completedURL pass on variables from Psychopy, such as participant ID?
I’m looking at having online participants provide demographics in Qualtrics after the experiment.

Something along the lines of
Completed URL https://youruni.qualtrics.com/my_demographics?$participant

Hi @Felix, yes, please see the documentation for Recruiting with Prolific Academic.

Hi @dvbridges, thanks for your reply. In the documentation, I find how to have psychopy read info from URLs and to write static information into URLs.

I’m looking for something a bit different: I want to have psychopy write dynamic info, such as the participant id into the completionURL.

Specifically, I want to redirect participants to Qualtrics after completing the experiment and have psychopy write the variable participant (unique for each ppt) into the completionURL, to have Qualtrics read it.

Sure, so what you need to do is use the completedURL field in the experiment settings, but add the contents as code using the dollar sign. E.g., $"url/" + expInfo['participant']. If i enter my participant ID as 1234 at the beginning of my Pavlovia task, this will redirect to a URL formatted as url/1234.

1 Like

that works. thanks a lot!

Hello
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

$"https://myUni.qualtrics.com/studyIdentityHere?subjectID=" + 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:

$"https://myUni.qualtrics.com/studyIdentityHere?subjectID="

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:

$“https://myUni.qualtrics.com/studyIdentityHere?randomID=” + randomID

or this:

$“https://myUni.qualtrics.com/studyIdentityHere?randomID=” + 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

`“https://myUni.qualtrics.com/studyIdentityHere?randomID=” + $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 = “https://myUni.qualtrics.com/studyIdentityHere?ID=” + "good"
elif accuracy < 0.5:
    my_url = “https://myUni.qualtrics.com/studyIdentityHere?ID=” + "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

"https://myUni.qualtrics.com/studyIdentityHere?ID=" + $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?