Howdy, Stranger!

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

Supported by

JATOS how to assign or collect participant number

Hello,

I have an experiment set up on JATOS ready to go but I was wondering if participant can input their own participant number or if the experiment assigns a unique participant number, if the participant can tell me the number later on?

I have a separate survey that the participant filled out and I need to be able to link the person to the survey and the experiment. Participant can stay anonymous, I just need to be able to match the experiment to their survey.

Thank you in advance!

Comments

  • Hi,

    I assume that you wrote your experiment using OSWeb? Then this question would belong in their forum.

    The answer is Yes, JATOS does assign each participant a unique ID (how exactly depends on the worker type you choose) and you can view it from the JavaScript and display it to participants. As an alternative, you could also ask your participants (again in the JavaScript) to input their ID from the survey into a text field, and that will get stored into the result data in JATOS. But regardless of which of these options you choose, it's always an issue of programming the right experiment on the JavaScript side (using OSWeb, if that's what you use), not on JATOS.

    Hope this helps

    Elisa

  • Hello Elisa

    Thank you so much for your help. Yes, I built it using OSWeb (Opensesame program). And sorry for misplacing my question! But thank you for still answering my question.

    But also, on JATOS, how can I display unique participant ID to the participant? I ask because Text Input in Opensesame is not compatible to run on JATOS.

    Thank you so much again!

  • Hi,

    I don't know how you would ask OSWeb to display dynamic text but the information is injatos.workerId

    So in standard JavaScript, here's an example of a minimal code you would need:

    <body>
      <p id="WorkerID_info"></p>
    </body>
     
    <script>
      document.getElementById("WorkerID_info").innerHTML = jatos.workerId;
    </script>
    


    Best

    Elisa

  • Hi @SoSo

    It's a long time ago that I worked on this, but as far as I can remember, if you leave the field `Possible subject nrs` empty in the OpenSesame extension for osweb, then the subject number used by osweb becomes Jatos' component result id. You should thus be able to use OpenSesame's internal subject_nr variable in this case. Please try this and let us know if this works.

    Buy Me A Coffee

  • Thank you so much @Daniel ! It worked!

    I was also wondering if there would be a way to include form_text_input in OpenSesame and be able to run it on JATOS. Or anything of similar nature. It would be most ideal if participants can simply input their 6-digit student ID during the experiment.

    Thank you in advance!

  • Glad to hear @SoSo

    Form items are still unsupported as of now, but are still high on our priority list. It seems counterintuitive that forms are not supported in a browser, while they are so common everywhere on the web. The reason is that osweb draws everything it shows on a HTML Canvas, and showing 'normal' forms requires one to switch away from (and later back to) the canvas, which is somehow still problematic to do reliably.

    How I usually solve this, especially if it only concerns one form item like you describe at the start or end of the experiment: Jatos allows one to compose an experiment from multiple components, so you could create the form using another library (such as jsPsych or lab.js) and add this as a component before or after the OpenSesame experiment. Although the form data will be logged to that separate component, Jatos will make sure the data is tied together once you export the data, or at least give you enough information to the data of the separate components (form + osweb experiment) back together.

    I hope this will work for you until we have the form components working in osweb!

    Buy Me A Coffee

  • Hi everyone!

    I am sorry to revive this again but I have a question, though a little bit different, reading this thread helped construct it.

    So, I have two different links for participants to do, and they are two blocks of one experiment. In each block, there are 12 lists that should be assigned to one participant. I was using subject_nr in OpenSesame with the "run if" conditions as @Daniel said, but since now I had to break the experiment in half, I need to use the ID number of the participant so that I make sure if a participant sees list 1 in block 1, they also see list 1 in block 2.

    I collect their ID numbers using an inline_javascript in the beginning of the experiment. But I am confused as to how to ensure that they see the correct list. Should I change something in JATOS' subj_nr field to make it somehow grab the ID? Even if so, how could I precisely, make an ID no 7200 see list 12 in block 1(link1) and list 12 again in block2(link2) and ID no for example 9000 see list 3...etc?

    I would be glad for all help.

    Best

    H

  • Hi Hulya.

    I'm sorry but it is really difficult to follow your question or understand what you are trying to achieve, so apologies if my reconstruction if incorrect:

    You want to make sure that the subject number predetermines which list one sees in both blocks? You could use something like the modulus operator: for instance. since you have 12 lists you could place something like this in the run_if condition for each list. I take list 5 as an example: [subject_nr] % 5 = 0. This means that whenever the remainder of the division of a subject nr by 5 is 0, then the item will be shown/executed. For list 6 this would be [subject_nr] % 6 = 0and so on.

    Does that make sense?

    Buy Me A Coffee

  • Hi @Daniel ,

    Thank you for your fast answer. I apologize that it was unclear.

    And yes, what I was doing was your solution, and it works perfect. But now, we will have two links in JATOS. One link will direct the participant to one list, using the modulus, right? And that same participant needs to click on the second link to do the second block - and that block should follow the first list of the first link they were assigned to: so Participant one, clicks on Link 1, sees block 1. Participant one, clicks on Link 2, should see block 1 in that too.

    I know JATOS assigns subject numbers and my modulus was working according to that when all the blocks were together in one link. Now, to make sure JATOS doesn't assign a list (because say, i am a subject, I click on Link 1 and JATOS tells my subject number is 870. And then I click on Link 2 to go on, and suddenly I am subject number 879 etc. That will assign the list in Link 2 wrongly to the same participant if I use the modulus. Does that make sense? )

    So, in the beginning of the Experiment, participants enter their ID number. Would this work, if my variable is ID number, and use the [ID] % 12 etc instead of [subject_nr] in both links? So if my ID is 360, and List 1 in Link 1 is [ID] % 12 = 0 and the same as Link 2, it will be inside OpenSesame that the List assignment will be executed, but not according to the number JATOS gives.

    I thought about this right after I sent the question so sorry that it took long, but in case if this could be a solution and if in the future someone needs a similar idea, I wanted to say :)

    Best,

    H

  • Hi again,

    So I tried my solution and it ignored the lists, I might be having a variable problem. I know this is not a JATOS question and I might be on the wrong place to ask... but I am really stuck :/ I have an [id] variable in an inline_javascript, and participants themselves write there. But how could I make OSWeb to take it for the modulus? I am really confused as to how that didn't work. Here is a Screenshot of what I am trying to achieve, and how my LoopID looks. I am reeallllllllllyy confused



  • Hi,

    Sorry for the third comment but I remembered @eduard helped me with an inline_javascript solution before as to how to assign participants to lists, and it was working well too. I didn't want to open a new thread nor distribute the question here and there, since I think either I may need to use JATOS' JSON input (? maybe) or in a way that OS does the trick for me. Maybe could you take a look too? :')

    Best,

    H

  • Hi Hülya,

    Yeah, I see what you mean. Ideally you would have started a new discussion, but now we can also just do it here. Don't worry.

    About this issue here, if I understand correctly, you want to do counterbalancing across participants (12 unique stimulus lists across 12 participants). The problem is that when splitting up the experiment in two parts, the variable that you used to assign the balancing ID, is different for the first and second session, of the same participant? Is that accurate?

    I don't know how and which variables JATOS assigns to participants or sessions. If there is any systematicity how the numbers are assigned you might make use of it. If you have a way to communicate with participant which ID they have, your solution could work in principle. Then, you would have let pp know what their number is and input it somewhere in the beginning of the experiment.

    If JATOS's assigment of subject IDs is arbitrary, and there is no option of specifying the same subject number and different session numbers for a multi-session experiment, and you have no way of communicating with your participant which ID to use, things are difficult.

    An ugly, but effective solution would be to hardcode the lists in 12 different versions of the experiment and upload all 12 experiments to JATOS (with the restriction that a participant can only participate in one of the 12). If you then split them in two sessions each, participant could probably be name identify which second session they should choose.

    Again, as I don't know what exactly the options are in JATOS and how much control you have over participants' input, I'm just guessing here.

    Eduard

    Buy Me A Coffee

  • Hi Eduard!

    Thanks for your amazing comprehensive answer, and letting me go for the discussion here.

    Yes- that is exactly the problem as you understood.

    And indeed, I can communicate their ID with them. I have an inline_javascript in the beginning of the experiment where they enter their ID using the keyboard. They put 4 numbers - it is set to that, whatever their ID is. And I can see the "id" variable in my variable inspector, also in the JATOS results. So I have that.

    Then, my question was: if I have that id input, why am I unable to tell the "run if" condition to use it instead of [subject_nr]? I also tried to overwrite the [subject_nr] by using it in my javascript code instead of [id], but that did not work either. I don't know if you could see my screenshots, but basically what I wanted to do was to use the modulus for the ID. Do you think I am missing something variable-wise? Because technically I feel like this should work:

    Participant enters ID, say 7200, modulus is set to % 12 = 0 for List12 in the overall experiment part in OpenSesame, so they are assigned to List 12. Same thing for my second half of the experiment, since they will for sure have the same ID. I feel like it is my programming-logic problem here: because intuitively this feels ok to work... Why can't I grab the id to tell it to the modulus...

    It is quite complicated to distribute the 12 lists, and yes, it would be an ideal option for this but also if I could figure out the solution aforementioned, that would make everything really easy...

    Best,

    H

  • How do you save the id variable?

    It must be of the form vars.id = <value>

    How exactly does it not work actually? Is always the same list selected? Could you share your code?

    Buy Me A Coffee

  • This is one of the codes I found in the forum and adapted for mine, and it looks like this:


    And, id is defined in the LoopID in an id column with " << " in the row below.

    How does it not work: It just totally ignores every list. I open the experiment, I enter the ID and hop - I see the debriefing at the very end of the experiment. Those two are both set to "always".

  • can you add the very end of this inline_javascript:

    console.log('ID IS = ' + vars.id)
    console.log('TYPE OF ID IS = ' +  typeof vars.id)
    console.log('TYPE OF ID IS = ' +  typeof vars.id)
    

    Just to find out which value the ID variable has. If you run it in the browser, you have to open to console to see the log appear. On firefox it is ctrl+shift+k

    Buy Me A Coffee

  • Hi there,

    I added it, here is how the console looks (Chrome) :


  • Sorry, the last one was meant to be:

    console.log('Mod OF ID IS = ' +  vars.id%12)
    

    Can you try again?

    Buy Me A Coffee

  • There we have it, tried with 2 different numbers


  • Okay, so that seems to work. Have you put your script in the run phase or prepare phase of the inline_script? Try the prepare phase.

    In general, I don't really have a clue what is happening. I am just trying out things here. If you upload your experiment here, i can play around with it a little more efficiently.

    Buy Me A Coffee

  • Oh my god

    @eduard , feel free to laugh at me for I made it so complicated.

    What I needed to was to put all my List sequences inside the GetID sequence in my first Loop. So basically a one total experiment item, so that it could grab the [id] variable.

    I hope this will be helpful for the future online experiments if people want to do different sessions regarding one ID and they are as newbie as me :) I think now I know how programming feels like...

    Take home message/question: I guess items don't communicate with each other if one variable is defined in another loop...

    Thank you for everything - hope to be helpful for future online enquiries :'))

    Best,

    H

  • Hi @hulya,

    Just some minor additions from my side:

    • You can pass along any subject_nr you desire along with the url to Jatos by adding it as a query parameter to the url, for example:

    https://jatos.cogsci.nl/publix/57/start?batchId=72&generalMultiple&subject_nr=333

    that way you control the subject_nr that is being used by osweb/jatos and can make sure participants have the same number where required

    • If you get `MOD of ID is NaN` try to convert the string representation of a number to an integer first.
    console.log('ID IS = ' + parseInt(vars.id))
    console.log('TYPE OF ID IS = ' +  typeof vars.id)
    console.log('Mod OF ID IS = ' +  vars.id%12)
    

    that should make the modulo operation succeed (if the NaN output gave problems).

    Buy Me A Coffee

  • Hi @Daniel ,

    Thank you very much for the tip!

    Though we are unable to contact them with particular details like this for now, hope to use it for my next attempts with more experience :)

    Thanks for the NaN tip too, though in my code after all 4 numbers were inserted the modulo operation worked fine and that's what we needed :) NaN is probably caused by the "<<" I have that moves whenever participant enters a number until it reaches 4 digits.

    Thank you a lot everyone. I have come so far thanks to all of your help.

    Best,

    H

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games