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


Author
Message
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
carolin.m - Friday, July 7, 2017
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

> 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?

Yes, you can leave it free. When setting the finish page via the script itself, this would override anything put there anyway.

> Moreover, does the '4' in [if (mod(script.groupid, 4) == 1)... refer to the 4 options?

Yes, it refers to the four different conditions / options. If you only have two, you would take the group id modulo 2.

> Also I have to ensure that the participant ID and

I assume you pass the participant in via a query parameter as well and have the script(s) use it as its subject id. If so, you can "reconstruct" that information in the outgoing links you set. See e.g. this example: https://www.millisecond.com/forums/FindPost16887.aspx

> a study ID (which are contained in the entry link) will be forwarded to the respective link.

You should be able to reconstruct that based on the passed in group id.

carolin.m
carolin.m
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 19, Visits: 54
Dave - Friday, July 7, 2017
carolin.m - Friday, July 7, 2017
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

> 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?

Yes, you can leave it free. When setting the finish page via the script itself, this would override anything put there anyway.

> Moreover, does the '4' in [if (mod(script.groupid, 4) == 1)... refer to the 4 options?

Yes, it refers to the four different conditions / options. If you only have two, you would take the group id modulo 2.

> Also I have to ensure that the participant ID and

I assume you pass the participant in via a query parameter as well and have the script(s) use it as its subject id. If so, you can "reconstruct" that information in the outgoing links you set. See e.g. this example: https://www.millisecond.com/forums/FindPost16887.aspx

> a study ID (which are contained in the entry link) will be forwarded to the respective link.

You should be able to reconstruct that based on the passed in group id.

Thanks for the quick reply!

Unfortunately I can't find the information concerning the "reconstruction" in the link you mentioned (https://www.millisecond.com/forums/FindPost16887.aspx).
Do you have another link for that?

Thanks,
Carolin

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
carolin.m - Monday, July 10, 2017

Thanks for the quick reply!

Unfortunately I can't find the information concerning the "reconstruction" in the link you mentioned (https://www.millisecond.com/forums/FindPost16887.aspx).
Do you have another link for that?

Thanks,
Carolin

<text screenouturl>
/ items = ("http://www.myopinions.com.au/Surveys/RewardSurvey.aspx?codes=spsqiogaap&id=<%script.subjectid%>")
</text>

this is the relevant part from the linked thread. It reconstructs the 'id' parameter.

Edited 7 Years Ago by Dave
carolin.m
carolin.m
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 19, Visits: 54
Dave - Thursday, September 1, 2016
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?
Hello Dave,

where exactly in the script do I add these information:
<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>

Apparently I can't find the right spot in my script :-/
Thanks!

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
carolin.m - Monday, July 10, 2017
Dave - Thursday, September 1, 2016
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?
Hello Dave,

where exactly in the script do I add these information:
<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>

Apparently I can't find the right spot in my script :-/
Thanks!

Suppose you have two groupids. Groupid equal to 1 indicates that the participant came from referral site A. Groupid equal to 2 indicates that the participant came from referral site B. I.e.

Site A -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=1&studyid=a
and
Site B -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=2&studyid=b

Depending on where they came from, you want to to send them back to either Site A or B, and pass on the subjectid and studyid contained in the original link.

You do
<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
...
</expt>

with

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://sitea.com/?subjectid=<%script.subjectid%>&studyid=a"
/ 2 = "http://siteb.com/?subjectid=<%script.subjectid%>&studyid=b"
</item>
carolin.m
carolin.m
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 19, Visits: 54
Dave - Monday, July 10, 2017
carolin.m - Monday, July 10, 2017
Dave - Thursday, September 1, 2016
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?
Hello Dave,

where exactly in the script do I add these information:
<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>

Apparently I can't find the right spot in my script :-/
Thanks!

Suppose you have two groupids. Groupid equal to 1 indicates that the participant came from referral site A. Groupid equal to 2 indicates that the participant came from referral site B. I.e.

Site A -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=1&studyid=a
and
Site B -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=2&studyid=b

Depending on where they came from, you want to to send them back to either Site A or B, and pass on the subjectid and studyid contained in the original link.

You do
<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
...
</expt>

with

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://sitea.com/?subjectid=<%script.subjectid%>&studyid=a"
/ 2 = "http://siteb.com/?subjectid=<%script.subjectid%>&studyid=b"
</item>

Thanks for the reply!
This is working now...however it only works when participants complete the task. If they quit the task earlier with Ctrl Q they get forwarded to the page that I entered in the inquisist script manager. Is it possible to still forward them to the questionnaire they came from when the quit the task earlier?

Many thanks in advance!
Carolin



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
carolin.m - Friday, July 28, 2017
Dave - Monday, July 10, 2017
carolin.m - Monday, July 10, 2017
Dave - Thursday, September 1, 2016
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?
Hello Dave,

where exactly in the script do I add these information:
<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>

Apparently I can't find the right spot in my script :-/
Thanks!

Suppose you have two groupids. Groupid equal to 1 indicates that the participant came from referral site A. Groupid equal to 2 indicates that the participant came from referral site B. I.e.

Site A -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=1&studyid=a
and
Site B -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=2&studyid=b

Depending on where they came from, you want to to send them back to either Site A or B, and pass on the subjectid and studyid contained in the original link.

You do
<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
...
</expt>

with

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://sitea.com/?subjectid=<%script.subjectid%>&studyid=a"
/ 2 = "http://siteb.com/?subjectid=<%script.subjectid%>&studyid=b"
</item>

Thanks for the reply!
This is working now...however it only works when participants complete the task. If they quit the task earlier with Ctrl Q they get forwarded to the page that I entered in the inquisist script manager. Is it possible to still forward them to the questionnaire they came from when the quit the task earlier?

Many thanks in advance!
Carolin



If you set the URL to redirect to at the very beginning as in the example (/onexptbegin), they should be redirected properly even if they quit early. Alternatively, why not provide the URL to the questionnaire in the web experiment's settings (what you refer to as "script manager," I think) as well? I.e., why is the URL you entered there a different one?

carolin.m
carolin.m
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 19, Visits: 54
Dave - Friday, July 28, 2017
carolin.m - Friday, July 28, 2017
Dave - Monday, July 10, 2017
carolin.m - Monday, July 10, 2017
Dave - Thursday, September 1, 2016
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?
Hello Dave,

where exactly in the script do I add these information:
<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>

Apparently I can't find the right spot in my script :-/
Thanks!

Suppose you have two groupids. Groupid equal to 1 indicates that the participant came from referral site A. Groupid equal to 2 indicates that the participant came from referral site B. I.e.

Site A -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=1&studyid=a
and
Site B -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=2&studyid=b

Depending on where they came from, you want to to send them back to either Site A or B, and pass on the subjectid and studyid contained in the original link.

You do
<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
...
</expt>

with

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://sitea.com/?subjectid=<%script.subjectid%>&studyid=a"
/ 2 = "http://siteb.com/?subjectid=<%script.subjectid%>&studyid=b"
</item>

Thanks for the reply!
This is working now...however it only works when participants complete the task. If they quit the task earlier with Ctrl Q they get forwarded to the page that I entered in the inquisist script manager. Is it possible to still forward them to the questionnaire they came from when the quit the task earlier?

Many thanks in advance!
Carolin



If you set the URL to redirect to at the very beginning as in the example (/onexptbegin), they should be redirected properly even if they quit early. Alternatively, why not provide the URL to the questionnaire in the web experiment's settings (what you refer to as "script manager," I think) as well? I.e., why is the URL you entered there a different one?

I solved it! Thank! The /onexptbegin command was not at the very beginning.
Regarding your question: the participants come from 2 different webpages and need to be sent back to the one they came from after the inquisit task. That's why there was another URL in the web experiment setting, at least for one group.

carolin.m
carolin.m
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 19, Visits: 54
Dave - Monday, July 10, 2017
carolin.m - Monday, July 10, 2017
Dave - Thursday, September 1, 2016
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?
Hello Dave,

where exactly in the script do I add these information:
<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>

Apparently I can't find the right spot in my script :-/
Thanks!

Suppose you have two groupids. Groupid equal to 1 indicates that the participant came from referral site A. Groupid equal to 2 indicates that the participant came from referral site B. I.e.

Site A -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=1&studyid=a
and
Site B -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=2&studyid=b

Depending on where they came from, you want to to send them back to either Site A or B, and pass on the subjectid and studyid contained in the original link.

You do
<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
...
</expt>

with

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://sitea.com/?subjectid=<%script.subjectid%>&studyid=a"
/ 2 = "http://siteb.com/?subjectid=<%script.subjectid%>&studyid=b"
</item>

Hello Dave, although the other issue is solved now this problem still occurs:
I want to refer my participants to two different webpages after the inquisit task, depending on the web page they came from.
I am pretty sure that I adjusted everything as described by you. However, sometimes participants get forwarded to the correct link and sometimes they get forwarded to the wrong link. What could be wrong?
Please see below the important parts of my script:

Site A: http://research.millisecond.com/carolinmuschalik/singlecategorypictureiat_rood_vlees.web?subjectid=123&study=999&groupid=1
Site B: http://research.millisecond.com/carolinmuschalik/singlecategorypictureiat_rood_vlees.web?subjectid=123&study=999&groupid=2

<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
</expt>

<expt>
/subjects = (1 of 2)
/groupassignment = groupnumber
/ blocks = [1=practice_compatibletest; 2=compatibletestinstructions; 3=compatibletest;
 4=practice_incompatibletest; 5=incompatibletestinstructions; 6=incompatibletest; 7=summary]
/onexptend = [values.completed = 1]
</expt>

<expt>
/subjects = (2 of 2)
/groupassignment = groupnumber
/ blocks = [1=practice_incompatibletest; 2=incompatibletestinstructions; 3=incompatibletest;
4=practice_compatibletest; 5=compatibletestinstructions; 6=compatibletest; 7=summary]
/onexptend = [values.completed = 1]
</expt>

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://fd8.formdesk.com/umhag/vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680">http://fd8.formdesk.com/umhag/vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680"
/ 2 = "http://fd8.formdesk.com/umhag/kopie_van_vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680">http://fd8.formdesk.com/umhag/kopie_van_vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680"
</item>

It would be great if you could help me with that!
Thanks in advance!



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
carolin.m - Monday, July 31, 2017
Dave - Monday, July 10, 2017
carolin.m - Monday, July 10, 2017
Dave - Thursday, September 1, 2016
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?
Hello Dave,

where exactly in the script do I add these information:
<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>

Apparently I can't find the right spot in my script :-/
Thanks!

Suppose you have two groupids. Groupid equal to 1 indicates that the participant came from referral site A. Groupid equal to 2 indicates that the participant came from referral site B. I.e.

Site A -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=1&studyid=a
and
Site B -> http://research.millisecond.com/yourusername/yourexperimentname.web?subjectid=someuniqueidentifier&groupid=2&studyid=b

Depending on where they came from, you want to to send them back to either Site A or B, and pass on the subjectid and studyid contained in the original link.

You do
<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
...
</expt>

with

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://sitea.com/?subjectid=<%script.subjectid%>&studyid=a"
/ 2 = "http://siteb.com/?subjectid=<%script.subjectid%>&studyid=b"
</item>

Hello Dave, although the other issue is solved now this problem still occurs:
I want to refer my participants to two different webpages after the inquisit task, depending on the web page they came from.
I am pretty sure that I adjusted everything as described by you. However, sometimes participants get forwarded to the correct link and sometimes they get forwarded to the wrong link. What could be wrong?
Please see below the important parts of my script:

Site A: http://research.millisecond.com/carolinmuschalik/singlecategorypictureiat_rood_vlees.web?subjectid=123&study=999&groupid=1
Site B: http://research.millisecond.com/carolinmuschalik/singlecategorypictureiat_rood_vlees.web?subjectid=123&study=999&groupid=2

<expt>
/ onexptbegin = [if (mod(script.groupid, 2) == 1) {defaults.finishpage = text.url.item.1}; ]
/ onexptbegin = [if (mod(script.groupid, 2) == 0) {defaults.finishpage = text.url.item.2}; ]
</expt>

<expt>
/subjects = (1 of 2)
/groupassignment = groupnumber
/ blocks = [1=practice_compatibletest; 2=compatibletestinstructions; 3=compatibletest;
 4=practice_incompatibletest; 5=incompatibletestinstructions; 6=incompatibletest; 7=summary]
/onexptend = [values.completed = 1]
</expt>

<expt>
/subjects = (2 of 2)
/groupassignment = groupnumber
/ blocks = [1=practice_incompatibletest; 2=incompatibletestinstructions; 3=incompatibletest;
4=practice_compatibletest; 5=compatibletestinstructions; 6=compatibletest; 7=summary]
/onexptend = [values.completed = 1]
</expt>

<text url>
/ items = urlitems
</text>

<item urlitems>
/ 1 = "http://fd8.formdesk.com/umhag/vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680">http://fd8.formdesk.com/umhag/vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680">http://fd8.formdesk.com/umhag/vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680"
/ 2 = "http://fd8.formdesk.com/umhag/kopie_van_vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680">http://fd8.formdesk.com/umhag/kopie_van_vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680">http://fd8.formdesk.com/umhag/kopie_van_vlees_consumptie2?page=3&nr=<%script.subjectid%>&study=184680"
</item>

It would be great if you could help me with that!
Thanks in advance!



> However, sometimes participants get forwarded to the correct link and sometimes they get forwarded to the wrong link.

Could you please show me the data you based this conclusion on?

And, for what it's worth, you can simplify your code and get rid of the 1st <expt> element:

<expt>
/ onexptbegin = [defaults.finishpage = text.url.item.1; ]
/subjects = (1 of 2)
/groupassignment = groupnumber
/ blocks = [1=practice_compatibletest; 2=compatibletestinstructions; 3=compatibletest;
 4=practice_incompatibletest; 5=incompatibletestinstructions; 6=incompatibletest; 7=summary]
/onexptend = [values.completed = 1]
</expt>

<expt>
/ onexptbegin = [defaults.finishpage = text.url.item.2; ]
/subjects = (2 of 2)
/groupassignment = groupnumber
/ blocks = [1=practice_incompatibletest; 2=incompatibletestinstructions; 3=incompatibletest;
4=practice_compatibletest; 5=compatibletestinstructions; 6=compatibletest; 7=summary]
/onexptend = [values.completed = 1]
</expt>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search