| Reference | Downloads | Github

Automatically incrementing participant number?

I’d like my experiment (run on pavlovia, interfacing with sona) to automatically assign a participant number, based on how many participants have completed the experiment. In other words, I want the first participant to be assigned participant number 1, and the next participant to be assigned participant number 2 (unless participant 1 failed to complete), and so on. I understand that it’s possible to incorporate participant IDs into links from sona, but unless I’ve missed something, those have to be hard coded rather than increment with experiment completions. Can anyone point me in the right direction? Thanks for reading!


1 Like

Do you have Qualtrics? I would like Sona to Qualtrics, add a participant ID there (see these notes for how), then redirect to PsychoPy with a URL than includes participant=id and then finally back to Sona.

Thanks for your reply. I’ll have to look into Qualtrics, as I’ve never used it before. Does this mean there’s no way to do this inside PsychoPy? Cheers!

If you don’t have Qualtrics then this isn’t a reason to get it. It’s not free.

The issue is that Pavlovia won’t save to custom files.

Why do you want consecutive ids? Why not just use the randomly generated id variable you can get from Sona?

Thanks again. The issue is that I have a custom counterbalancing of stimuli based on participant number, so I want one participant for each participant number (restricted to 1-30). It turns out my university does have qualtrics but I’ve never used it and fear that adding two new platforms (haven’t used psychopy before either) in one experiment is asking for trouble. I’ll look into the sona random id variable to see if that will work - is that a fairly easy tweak? Cheers!

I’m planning to use Qualtrics for all online PsychoPy experiments to present the PI sheet, gather demographics and assign equally to conditions. The link to my notes above also has details about how to create a custom Sona link. I also have some Qualtrics and PsychoPy primer slides at

An ID from Qualtrics will increment whether or not the participant completes the PsychoPy so that aspect will be tricky anyway. You’d probably need to keep an eye on which participant numbers have completed and reuse other counterbalancing orders.

Alternatively, randomise your orders instead.


Assign Consecutive Participant IDs

I have written a web app. which can be used for Pavlovia experiments:

The page takes four parameters: folder, experiment, id and researcher.

folder (required) is your Pavlovia username

experiment (required) is your experiment name as formatted for the study link

id (optional) is a unique code which you could assign, for example as a random number in Qualtrics, so you can link your PsychoPy data back. It is passed to Pavlovia unchanged

researcher (optional) is also passed to Pavlovia unchanged. I am using it to ensure that participants start in Qualtrics where they can view the participant information sheet, not Pavlovia.

participant is assigned by my app. as a consecutive number. You could use a modulus of participant in order to assign participants to conditions. The number increments whether or not the participant finishes. It would be considerably more complicated to re-assign aborted participant numbers.

Example URL: