Best way to collect demographics

What is the best way everyone has found to record demographic data? I only need age and gender to be recorded before my experiment.

thanks!

Hello,
I would say the easier way to do it is simply adding Experiment Info, especially because you only have 2 generic questions.
https://www.psychopy.org/builder/settings.html

image

filename = thisDir + os.sep + u’data/%s%s_%s’ % (expInfo[‘participant’], expName, expInfo[‘date’])
KeyError: ‘participant’
################ Experi

this is the error code received after entering in age and gender

Normally, when nothing is changed, PsychoPy asks for a Participant ID in this Experiment Info Dialogue. It then uses this ID in the file names for data output.
When removing the participant entry from the Experiment Info Dialogue, PsychoPy does not generate the ID anymore. So you have to change the way PsychoPy generates file names for data output: You have to tell PsychoPy that it should not use the participant ID for file names.
Go to experiment Settings → Data and change the Data Filename entry to

u'data/%s_%s' % (expName, expInfo['date'])

Alternativley, add the Participant ID back to the Experiment Info Dialogue by readding a field labeld participant with f"{randint(0, 999999):06.0f}" as the default option:

1 Like

Is there an option before selecting the gender (male or female) to have a grey-shaded option where it says “Please select” instead of the currently displayed pre-selected option “male” as that could have some participants falsely give wrong data, meaning that it would not allow proceeding with the experiment until the participant has selected their option (gender)?

Also, is there an option to make the field required in order for the participant to proceed with the experiment? I have seen a forum thread saying that putting the "" after the variable would resolve it (for example gender), but that does not seem to be legitimate (does not work).

You could put something like

['Please select','Woman','Man','Non-binary','Other','Prefer not to say']

If gender* doesn’t work (it should work online but not locally) you could add a routine in the experiment to check that expInfo[‘gender’} != ‘Please select’

1 Like

Thank you for your response! Also did help me, though I would like to elaborate on an issue I keep having:

I obviously understand how to put the ‘Please select’ option within the settings, but not sure where I would place the expInfo[‘gender’} != ‘Please select’ option, like in which coding (i.e., Before Experiment/Before Routine)? Would there need to be any other coding before this code? Because I have tried placing it in a code and it sent me this error message: /* Syntax Error: Fix Python code */

Thanks