Pavlovia how to pass participant ID from survey to experiment

Description of the problem:
The first part of the study is a survey on pavlovia where participants have to generate a unique participant code (first 2 letters of birth month followed by last 3 letters of surname or something like that). After they do this survey they are url redirected to the experiment which is a Stroop task. How can I have the answer from this PID survey question automatically become the participant id for the Stroop task??

I’ve been trying for a few days but can’t figure this out!

What have you tried so far? Off the top of my head, it sounds like something you should be able to do with URL parameters. Basically, you include the relevant PID as a variable in the redirect URL (e.g., instead of redirecting to you redirect to or something), and then capture it in your experimental code.

[Edit: Just to add something a bit more useful, here’s a function I stole from somewhere that does this:

function getParameterByName(name, url = window.location.href) {
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));

One can then use it to get the value from the URL as follows:

var PID = getParameterByName('PID');

PID should then be usable in the same way as any other variable in your code.]