How to redirect participants to different urls, depending on their groupid


Author
Message
lfj88
lfj88
Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)
Group: Forum Members
Posts: 10, Visits: 45
Dear reader,

I have one script that needs to redirect participants from 4 different conditions to 4 different urls. The finish page in my account on Millisecond only allows for one url, so I tried to create a referral to the url in the Inquisit script, which times out after x milliseconds (not ideal, but as far as I know the link just needs to be opened to confirm the participant has completed the study and I don't think the participant has to click anything on that webpage). I need to be able to change that url depending on the groupid. I tried it using a list or a value, but both do not seem to work.

See below for the relevant code I used. For the url, I put in a google page as an example. So far, I only specified the url for groupid=1. In the code below, I try to use the list. I have also tried it with value. In that case: in the expt command, I then substituted 
list.prolific_url.appenditem("?gfe_rd=cr&ei=DPrGV_yAGsexOuyWvPAK#q=happy")
 with
values.urlvalue = "?gfe_rd=cr&ei=DPrGV_yAGsexOuyWvPAK#q=happy"
and in the html command, I substituted
<% list.prolific_url.currentvalue %>
with
<% values.urlvalue %>

However, both do not seem to work. Using a value (opposed to a list) seems most effective, as it does print the correct url when I add "https://www.google.nl/<% values.urlvalue %>"in a caption of a radiobuttons item that happens to be in my script, but when it actually opens the url later in the script, it seems to use the original value of urlvalue ('bla'), not the value that should be assigned to urlvalue on the beginning of the experiment.

Any ideas as to what goes wrong or how else I can accomplish the goal of redirecting participants to different urls, depending on their groupid?

Kind regards,
Lin

*** URL PARTICIPANTS NEED TO BE SENT TO UPON COMPLETION OF STUDY ***
<list pr_url>
/selectionmode = sequence
</list>

<values>
/ urlvalue = "bla"
</values>

<html pr_url>
/items = ("https://www.google.nl/<% list.prolific_url.currentvalue %>")
</html>

<trial pr_url>
/stimulusframes = [1=pr_url]
/showmousecursor = True
/timeout = 10000
</trial>

<block pr_url>
/trials = [1=pr_url]

***EXPERIMENT***
<expt RC>
/ blocks = [1=resolution; 2=consent; 3=distr; 4=forced_choice_block1; 5=forced_choice_block2; 6=forced_choice_block3; 7=forced_choice_block4; 8=forced_choice_block5; 9=demographics; 10=pr_url]
/ postinstructions = (end)
/ onexptbegin = [if (script.groupid == 1) {list.condition_names.appenditem("very negative"); list.condition_names.appenditem("slightly negative"); list.condition_names.appenditem("VERY NEGATIVE"); list.prolific_url.appenditem("?gfe_rd=cr&ei=DPrGV_yAGsexOuyWvPAK#q=happy");}]
/ onexptbegin = [if (script.groupid == 2) {list.condition_names.appenditem("slightly negative"); list.condition_names.appenditem("very negative"); list.condition_names.appenditem("SLIGHTLY NEGATIVE");}]
/ onexptbegin = [if (script.groupid == 3) {list.condition_names.appenditem("slightly positive"); list.condition_names.appenditem("very positive"); list.condition_names.appenditem("SLIGHTLY POSITIVE");}]
/ onexptbegin = [if (script.groupid == 4) {list.condition_names.appenditem("very positive"); list.condition_names.appenditem("slightly positive"); list.condition_names.appenditem("VERY POSITIVE");}]
</expt>



Dave
Dave
Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)
Group: Administrators
Posts: 11K, Visits: 73K
What you should do is simply set the defaults.finishpage property to the desired URL depending on the groupid.

<expt>
/ onexptbegin = [if (mod(script.groupid, 4) == 1) defaults.finishpage = "http://www.example.com/"]
/ onexptbegin = [if (mod(script.groupid, 4) == 2) defaults.finishpage = "http://www.google.com/"]
/ onexptbegin = [if (mod(script.groupid, 4) == 3) defaults.finishpage = "http://www.yahoo.com/"]
/ onexptbegin = [if (mod(script.groupid, 4) == 0) defaults.finishpage = "http://www.bing.com/"]
...
</expt>

Hope this helps.

lfj88
lfj88
Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)
Group: Forum Members
Posts: 10, Visits: 45
Thanks, but unfortunately that does not work either. When I then go through the experiment it simply stops at the end, but does not open any webpage.
I put it in the script exactly the way you typed it. Any idea why this would not work?
Dave
Dave
Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)
Group: Administrators
Posts: 11K, Visits: 73K
What does "when I go through the script" mean here specifically? Are you completing it online (Inquisit Web) or testing in Inquisit Lab? Redirection will only occur under Inquisit Web. If you are running this under Inquisit Web, please provide the link to the respective launch page / script online.

Dave
Dave
Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)
Group: Administrators
Posts: 11K, Visits: 73K
Guessing here, but I assume this is the web experiment you are talking about:

http://research.millisecond.com/inq2bsiweb/RC_criteria_plaatjes.web (launch page)

with the script being

http://www.millisecond.com/myaccount/scripts/inq2bsiweb/RC_criteria_plaatjes/RC_criteria_plaatjes.iqx

The script that's currently uploaded makes no attempt whatsoever to set the defaults.finishpage property. This is the entire <expt> element as it currently exist in that script:

<expt RC>
/ blocks = [1=resolution; 2=consent; 3=distr; 4=forced_choice_block1; 5=forced_choice_block2; 6=forced_choice_block3; 7=forced_choice_block4; 8=forced_choice_block5; 9=demographics]
/ postinstructions = (end)
/ onexptbegin = [if (mod(script.subjectid, 4) == 1) {list.condition_names.appenditem("very negative"); list.condition_names.appenditem("slightly negative"); list.condition_names.appenditem("VERY NEGATIVE");}]
/ onexptbegin = [if (mod(script.subjectid, 4) == 2) {list.condition_names.appenditem("slightly negative"); list.condition_names.appenditem("very negative"); list.condition_names.appenditem("SLIGHTLY NEGATIVE");}]
/ onexptbegin = [if (mod(script.subjectid, 4) == 3) {list.condition_names.appenditem("slightly positive"); list.condition_names.appenditem("very positive"); list.condition_names.appenditem("SLIGHTLY POSITIVE");}]
/ onexptbegin = [if (mod(script.subjectid, 4) == 0) {list.condition_names.appenditem("very positive"); list.condition_names.appenditem("slightly positive"); list.condition_names.appenditem("VERY POSITIVE");}]
</expt>

In other words: You are not redirecting anywhere and the script just ending without redirection is the correct behavior.


Dave
Dave
Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)
Group: Administrators
Posts: 11K, Visits: 73K
So, here's a little script to test:

Condition 1:
http://research.millisecond.com/david.nitz/redir.web?groupid=1
Condition 2:
http://research.millisecond.com/david.nitz/redir.web?groupid=2
Condition 3:
http://research.millisecond.com/david.nitz/redir.web?groupid=3
Condition 4:
http://research.millisecond.com/david.nitz/redir.web?groupid=4

Redirection to different URLs depending on the group id works perfectly fine for me. This is the entirety of the code:

<expt>
/ onexptbegin = [if (mod(script.groupid, 4) == 1) {defaults.finishpage = "http://www.example.com/"}; ]
/ onexptbegin = [if (mod(script.groupid, 4) == 2) {defaults.finishpage = "http://www.google.com/"}; ]
/ onexptbegin = [if (mod(script.groupid, 4) == 3) {defaults.finishpage = "http://www.yahoo.com/"}; ]
/ onexptbegin = [if (mod(script.groupid, 4) == 0) {defaults.finishpage = "http://www.bing.com/"}; ]
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("Your group id is <%script.groupid%>.~nYou'll be redirected to <%defaults.finishpage%>.")
/ size = (75%, 50%)
</text>

Direct link to the script: http://www.millisecond.com/myaccount/scripts/david.nitz/redir/redir.iqx

When you run this, are you being redirected or not?

lfj88
lfj88
Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)
Group: Forum Members
Posts: 10, Visits: 45
Hi Dave,

Thanks for all the answers! That's an earlier version of the script that you found on Inquisit Web. I was indeed testing it in Inquisit Lab, not Inquisit Web (I would first have to delete the earlier version to make space for the new one, but I still needed the earlier version up there), so that explains it.

I had used urls in Inquisit Lab before (but not as a finishpage), so I didn't know this wouldn't work in Inquisit Lab.
Thanks for your help!


carolin.m
carolin.m
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 19, Visits: 54
lfj88 - Thursday, September 1, 2016
Hi Dave,

Thanks for all the answers! That's an earlier version of the script that you found on Inquisit Web. I was indeed testing it in Inquisit Lab, not Inquisit Web (I would first have to delete the earlier version to make space for the new one, but I still needed the earlier version up there), so that explains it.

I had used urls in Inquisit Lab before (but not as a finishpage), so I didn't know this wouldn't work in Inquisit Lab.
Thanks for your help!


Hello Dave,

I have a similar question. I have people who come from 2 different links to my inquisit web experiment. After they are finished with inquisit I want to redirect them (depending on from which link they came) back to their respective link. So I need two different redirects.

How would it be possible?

Thanks in advance!

Carolin

Dave
Dave
Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)Supreme Being (957K reputation)
Group: Administrators
Posts: 11K, Visits: 73K
carolin.m - Thursday, July 6, 2017
lfj88 - Thursday, September 1, 2016
Hi Dave,

Thanks for all the answers! That's an earlier version of the script that you found on Inquisit Web. I was indeed testing it in Inquisit Lab, not Inquisit Web (I would first have to delete the earlier version to make space for the new one, but I still needed the earlier version up there), so that explains it.

I had used urls in Inquisit Lab before (but not as a finishpage), so I didn't know this wouldn't work in Inquisit Lab.
Thanks for your help!


Hello Dave,

I have a similar question. I have people who come from 2 different links to my inquisit web experiment. After they are finished with inquisit I want to redirect them (depending on from which link they came) back to their respective link. So I need two different redirects.

How would it be possible?

Thanks in advance!

Carolin

> How would it be possible?

It's probably not possible. If the only distinction between the two groups of participants is the link they came from, the script doesn't know about that and cannot adjust the URL to redirect to accordingly. You would have to provide the launch page and script with some additional info that the script "knows" about -- such as a specific groupid for group A vs group B passed in via a query parameter. You can then have the script set the link to redirect to accordingly, as shown in the example in this thread.

carolin.m
carolin.m
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 19, Visits: 54
Dave - Thursday, July 6, 2017
carolin.m - Thursday, July 6, 2017
lfj88 - Thursday, September 1, 2016
Hi Dave,

Thanks for all the answers! That's an earlier version of the script that you found on Inquisit Web. I was indeed testing it in Inquisit Lab, not Inquisit Web (I would first have to delete the earlier version to make space for the new one, but I still needed the earlier version up there), so that explains it.

I had used urls in Inquisit Lab before (but not as a finishpage), so I didn't know this wouldn't work in Inquisit Lab.
Thanks for your help!


Hello Dave,

I have a similar question. I have people who come from 2 different links to my inquisit web experiment. After they are finished with inquisit I want to redirect them (depending on from which link they came) back to their respective link. So I need two different redirects.

How would it be possible?

Thanks in advance!

Carolin

> How would it be possible?

It's probably not possible. If the only distinction between the two groups of participants is the link they came from, the script doesn't know about that and cannot adjust the URL to redirect to accordingly. You would have to provide the launch page and script with some additional info that the script "knows" about -- such as a specific groupid for group A vs group B passed in via a query parameter. You can then have the script set the link to redirect to accordingly, as shown in the example in this thread.

Thanks for the reply! When I add these information to the scriot, do I leave the predefined field for the forward link in the edit section of the experiment free?
Moreover, does the '4' in [if (mod(script.groupid, 4) == 1)... refer to the 4 options? So in my case I have to adjust it with '2' ?
Also I have to ensure that the participant ID and a study ID (which are contained in the entry link) will be forwarded to the respective link.
Is that possible and if so how?

Thanks a lot in advance!
Carolin

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search