Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Read query string values in OSweb

edited December 2021 in OSWeb

Hello everyone :)

My experiment contains 2 part at 2 different times and will run in cloudresearch platform.

I would like to read the participants' user number (their ID for this platform) to match between the two parts of their experiment.

There is any way to do it?

Thank you!

Zohar.

Comments

  • Hi @zohar,

    You can pass parameters to JATOS through the experiment's URL (see https://www.jatos.org/jatos.js-Reference.html#original-url-query-parameters).

    So, as long as you can generate a individual link from whatever platform you're using, you will be able to pass, say the subject's id, to the task.How the URL is generated and how you retrieve the information you want to pass on will depend on the platform you're using (please refer to your platform's documentation).

    You may be interested in this video: https://youtu.be/1WvTUQr0JL0

    I also recommend you read the following thread: https://forum.cogsci.nl/discussion/6993/using-prolific-ids-in-osweb-experiment

    Here's some Javascript code you can include at the onset of your experiment (under the "prepare" tab):

    if (typeof jatos !== "undefined") {
    // obtain information from JATOS Url
       var sub_id = jatos.urlQueryParameters.sub_id; 
       vars.sub_id = sub_id ? sub_id : "empty";
    } else {
       vars.sub_id = "empty";
    }
    

    Let's say you generated a General Multiple Worker link in JATOS for your experiment and that this link is https://jatos.mindprobe.eu/publix/999/start?batchId=101&generalMultiple. From your platform, you need to generate, for specific subject, a link that will add the subject'd id as a parameter to that URL: https://jatos.mindprobe.eu/publix/999/start?batchId=101&generalMultiple&subid=S01928 (in this example, the subject's individual id is S01928). Note that here, we're using "&" to add a parameter because the URL already includes parameters. If it didn't, you'd have to add "?sub_id=S01928".

    The Javascript aboce makes sure to capture the subject's id and save it in the vars.sub_id variable. You need to make sure your data logger includes it to see if feature in your data output.

    You can use a similar technique to pass on a session id, or whatever else is relevant for your experiment.

    Hope this helps.

    Fabrice.

    Buy Me A Coffee

  • It works great. thank you!

Sign In or Register to comment.