| Reference | Downloads | Github

How to change the name of the data file when running online experiment

in psychopy coder we can change the data file name : filename = thisDir + os.sep + u’data/%s%s’ % (expInfo[‘phone_number:’],expInfo[‘student_number’])
but in the javascript export by the builder , I cannot find the place to change the data file name, do you guys know how to change it ?

Custom file paths aren’t yet supported for PsychoJS, but we can add it to the list of things to do. I think storing the participant’s phone number or their student ID (or any identifying data) is a worry from a GDPR perspective though (i.e. are you sure you aren’t breaking the law?). I’d strongly strongly recommend against it. Try to store a participant ID and any relationship between that and the personal data should be stored elsewhere (pseudonamised).

Hi Jon, any update on this? I’m trying to use a custom data filename for an online study on Pavlovia, but can’t seem to get it to work.

I have the same issue as yours.
I’m looking forward for the solution.

I have the same problem. I changed it in the builder but for some reason this wont update online.

I am trying to create a random participant ID and save that to the file

Is this related to my latest error:
ReferenceError: _thisDir is not defined

I am trying to save the number of participants in each group into a separate file.


Python code
summary = _thisDir + os.sep + ‘groups’
thisSum = data.ExperimentHandler(name=expName, version=’’,
extraInfo=’’, runtimeInfo=None,
savePickle=False, saveWideText=False,

Javascript code
summary = ((_thisDir + os.sep) + “groups”);
thisSum = new data.ExperimentHandler({“name”: expName, “version”: “”, “extraInfo”: “”, “runtimeInfo”: null, “originPath”: null, “savePickle”: false, “saveWideText”: false, “dataFileName”: summary});

If I circumvent the _thisDir error by setting summary=“groups”; then I get the following error instead.

ReferenceError: data is not defined

Best wishes,


No, I’m afraid that saving custom filenames and/or folders still isn’t supported. I guess this is growing in popularity and the question is where it should fit with respect to requests for forms, microphone/video recording, staircases. Maybe we need a place to track how many people are needing each feature so we prioritise correctly. We do also have a new member of staff starting to work on JS in a few weeks so hopefully we’ll be able to progress faster through the feature requests


I am also keen to have this feature be available as my current experiment won’t work without it. it also won’t work without pandas, as I need to manipulate the results files, and then save it with a specific and participant unique filename. but that is another conversation, but if anyone knows how to solve part of this. Let me know

Are you trying to allocate equal numbers of participants to different groups?

I’ve written a couple of tools for this, though I’m personally using Qualtrics embedded data instead.

The disadvantage of my Qualtrics method AND both of my web apps is that they allocate evenly to experiment starters but don’t adjust based on who finished. I could write such an app but I’d need a sponsor since it could take a day or two and I don’t currently need it. That app would allocate to groups but have allocations expire if they weren’t confirmed (by a call from the last routine of the experiment) within a few hours. This still wouldn’t be perfect, since I wouldn’t be able to tell if there was an error during the saving process.

I thought I’d suggest another reason why this feature would be useful: being unable to change log file names causes a privacy issue when making a repository public.

In my experiments, I have used the database system to record data, but individual log files for each participant still automatically save to my repository. When using for participant recruitment, each log file name in the repository includes a Prolific participant ID, which should not be made public:

“If you are considering releasing your data on an open data sharing platform such as OSF or a university data repository, then you should remove the Prolific IDs.” source