# Limit the number of times a participant can take part

**URL:** <https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626>\
**Category:** Online experiments\
**Tags:** pavlovia\
**Created:** [October 26, 2021, 11:22am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626 "2021-10-26T11:22:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yao](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yao/32/15921_2.png) [@Yao](https://discourse.psychopy.org/u/Yao)\
**Post date:** [October 26, 2021, 11:22am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/1 "2021-10-26T11:22:17Z")

</div>

URL of experiment: [corsi\_neu [PsychoPy]](https://run.pavlovia.org/YaoXiong/corsi-block-tapping/html)

Description of the problem:  
Hi there!  
I’m running my experiment on pavlovia now and I found that I had some subjects who would click on the link multiple times to do the task, so their data would be recorded many times. And I only need each participant to do it once.  
I was wondering if I can set my experiment so that participants who have already participated will not be able to access it again?  
Thank you very much!

---

<div class="post-metadata">

**Author:** ![Becca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/becca/32/34260_2.png) [@Becca](https://discourse.psychopy.org/u/Becca)\
**Post date:** [October 27, 2021, 11:06am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/2 "2021-10-27T11:06:34Z")

</div>

Hi There,

This is not possible out of box just yet I am afraid. There are 2 ways you could do this in theory:

1. Your recruitment service might allow a way of approaching this e.g. prolific allows a list of participants that are not permitted to take part via a custom screener (e.g. because they have done so already).
2. If you have a list of participant IDs that have taken part you can add some custom code to make sure that participant doesn’t take part again

e.g.

```auto
participants_not_allowed = [1, 123, 432]
studyReps = 0
if int(expInfo['participant']) in participants_not_allowed:
    studyReps = 0
# then wrap a loop around all routines in the study and set the nReps field to studyReps

```

Unfortunately however this does require some manual intervention, so it wouldn’t prevent an immediate double click.

Becca

---

<div class="post-metadata">

**Author:** ![Yao](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yao/32/15921_2.png) [@Yao](https://discourse.psychopy.org/u/Yao)\
**Post date:** [November 3, 2021, 9:27am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/3 "2021-11-03T09:27:56Z")

</div>

Thank you! Yes, I do have the participant IDs, but that’s really a lot, more than a hundred. Looks like I’ll need to enter them one by one.

---

<div class="post-metadata">

**Author:** ![Becca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/becca/32/34260_2.png) [@Becca](https://discourse.psychopy.org/u/Becca)\
**Post date:** [November 3, 2021, 9:36am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/4 "2021-11-03T09:36:39Z")

</div>

if you have a list of IDs I would suggest making a script to extract them and write the string. For example, typically participant IDs are the first value in the csv file followed by an underscore. If you run the below inside PsychoPy coder it would allow you to select your existing data files and then print out a string in your output window to be copied into your code.

```auto
from psychopy import gui

# open a gui to select data files
filenames = gui.fileOpenDlg(allowed="*.csv")

participant_IDs = []

for filename in filenames:
    thisID = filename.split("_")[0]
    participant_IDs.append(thisID)

print("Please copy this list into your code")
print(participant_IDs)

```

Hope this helps,  
Becca

---

<div class="post-metadata">

**Author:** ![Yao](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yao/32/15921_2.png) [@Yao](https://discourse.psychopy.org/u/Yao)\
**Post date:** [November 3, 2021, 9:39am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/5 "2021-11-03T09:39:15Z")

</div>

Thanks a lot! It’s helpful. But I also need an instant way to block double clicks, which doesn’t seem to be feasible …

---

<div class="post-metadata">

**Author:** ![Becca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/becca/32/34260_2.png) [@Becca](https://discourse.psychopy.org/u/Becca)\
**Post date:** [November 3, 2021, 9:40am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/6 "2021-11-03T09:40:26Z")

</div>

Hi There,

Yes - unfortunately not doable at the moment. This is something currently handled by the recruitment platform side (i.e. prolific, sona etc).

Becca

---

<div class="post-metadata">

**Author:** ![Yao](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yao/32/15921_2.png) [@Yao](https://discourse.psychopy.org/u/Yao)\
**Post date:** [November 3, 2021, 9:42am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/7 "2021-11-03T09:42:05Z")

</div>

Thank you for your detailed answer! It’s very enlightening!  
Yao

---

<div class="post-metadata">

**Author:** ![Yao](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yao/32/15921_2.png) [@Yao](https://discourse.psychopy.org/u/Yao)\
**Post date:** [November 3, 2021, 9:48am UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/8 "2021-11-03T09:48:59Z")

</div>

Hi Becca,  
I was wondering if it would be possible to limit participant IDs to one click on the link, limiting their clicks before they participate in the experiment, rather than after they click?  
If this works, then I don’t have to change the code after they have participated.  
Yao

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 3, 2021, 12:28pm UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/9 "2021-11-03T12:28:49Z")

</div>

How are you distributing the link?

You might find the [VESPR Study Portal](https://moryscarter.com/vespr/portal/) useful if you want participant IDs to be generated automatically but limit the chances of accidental double-clicking.

Alternatively, Qualtrics can be set up to send single use links to a contact list.

---

<div class="post-metadata">

**Author:** ![Yao](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yao/32/15921_2.png) [@Yao](https://discourse.psychopy.org/u/Yao)\
**Post date:** [November 3, 2021, 1:10pm UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/10 "2021-11-03T13:10:49Z")

</div>

We distribute the links in a learning system (part of the experiment), before which we have generated the IDs of the participants.  
The subjects were asked to do lots of tasks, we needed to keep them using the same ID for different tasks.  
So it would be good if I could set the students to click only once in psychopy.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [November 3, 2021, 2:21pm UTC](https://discourse.psychopy.org/t/limit-the-number-of-times-a-participant-can-take-part/25626/11 "2021-11-03T14:21:00Z")

</div>

If the link can contain the personal id (like a mail merge) then you can send it as ?id= in a portal link.

However, if you are talking about participants doing multiple experiments one after another in the same session, then perhaps you actually want to use [daisy chaining](https://discourse.psychopy.org/t/psychopy-online-demos/22319/3#demo_chaining-16) so each experiment sends them to the next one, passing the id value with it.
