0 votes
in Methoden-Fragen by s135647 (135 points)

Hello all,

I am designing a study in two parts. There is a two weeks gap between Part 1 and Part 2 and I need to be able to match participant's data from Part 1 to Part 2, while remaining anonymous so I cannot use names, or email addresses as they very often contain names.

I was thinking of having participants generate a random string using the following link:

https://www.random.org/strings/?num=1&len=10&digits=on&upperalpha=on&loweralpha=on&unique=on&format=html&rnd=new

The generated string would become their unique, anonymous, identifier.

Then participants would be prompted to enter this random string in a text input, so that I would have it.
However, I would also like them to receive said string via email so that they would have it and not lose the string between the two parts of the study. All that without storing their email, so that it remains anonymous.

I have seen the possibility to send emails to them without storing addresses so that's great.
But I am unsure on the possibility for the email to include the content of their text input.

What I would like is for the participant to get an email that says:


Find below your unique identifier:
"RANDOM STRING ENTERED BY PARTICIPANT IN THE TEXT INPUT"


If one can help me do that, that would be great.

Or, if someone has a different idea on how to match the data between the two parts more elegantly, I am also happy to hear about it!
Thanks in advance for your help.

1 Answer

0 votes
by SoSci Survey (305k points)
selected by s135647
 
Best answer

I cannot use names, or email addresses as they very often contain names.

Before giving up on that idea, please give this a read:
Multi-Wave Surveys with Self-Recruited Respondents

I was thinking of having participants generate a random string using the following link

A bit complicated just to create a radom string, isn't it? Even more so, as you can use PHP code to create a radom string in SoSci Survey:

$chars = '23456789ABCDEFGHKLMNPQRSTUVWXYZ';
$length = 8;
$s = '';
$maxChar = strlen($chars)-1;
for ($i=0; $i<$length; $i++) {
	$random = mt_rand(0, $maxChar);
	$s.= $chars[$random];
}

Okay, but now there's still a (very little) chance that two respondents will get the same key. No problem, you can also paste a list of random strings (genereated in the mailing -> authentification code feature of SoSci Survey, for example) into a random generator and just draw a different code for each respondent.

I personally would still ask for the e-mail-address (not connected to the data set from your view), using an opt-in as explained in the link at the top of my response.

by s135647 (135 points)
Thanks that was very helpful!
by s135647 (135 points)
Hello,

I am now coming back to the implementation of this (covid delayed everything as we have a lab session).

We chose to follow your second option, to generate the random string in the survey.

I tried pasting this in a php code but unfortunately nothing seems to happen. Apologies, my level of coding is quite low.

What I would like to do is the code to generate the random string, display it on screen and automatically store it in a variable. Could you please help we achieve that?

Sorry, I know it's a lot!
Thank you very much in advance
by SoSci Survey (305k points)
> I tried pasting this in a php code but unfortunately nothing seems to happen.

Nothing you can see. You have the random string in Variable $s. But you shall do something with that. For example store it into an internal variable using put() and display it on the screen, using html() and/or replace().
by s135647 (135 points)
Hello, thanks I have been able to create an internal variable, store it and display it :)

However, it seems that the random generator does not work as I had expected it.
First, the length is not 8.
Second, characters seem to be repeated a lot, which greatly diminishes the number of option. Would you know why that is?

Some examples of strings I get, and the code I am using below:
FFPFPSFPSCFPSCCFPSCCFFPSCCFAFPSCCFAG
PPHPHXPHXQPHXQMPHXQMNPHXQMNNPHXQMNNE
EEDEDEEDEUEDEUTEDEUT4EDEUT47EDEUT47R

The code:

$chars = '23456789ABCDEFGHKLMNPQRSTUVWXYZ';
$length = 8;
$s = '';
$maxChar = strlen($chars)-1;
for ($i=0; $i<$length; $i++) {
    $random = mt_rand(0, $maxChar);
    $s.= $chars[$random];
put('RN05_01', $s);
html($s);
}
by SoSci Survey (305k points)
Oh, the length is 8 as your data set should show. But you show every step, cause the put() and html() commands are within the FOR-loop. Just put the closing bracket two lines above:

$chars = '23456789ABCDEFGHKLMNPQRSTUVWXYZ';
$length = 8;
$s = '';
$maxChar = strlen($chars)-1;
for ($i=0; $i<$length; $i++) {
    $random = mt_rand(0, $maxChar);
    $s.= $chars[$random];
}
put('RN05_01', $s);
html($s);

What you see is ever step of code generation. Let me write your first line a bit different:

F-FP-FPS-FPSC-FPSCC-FPSCCF-FPSCCFA-FPSCCFAG
by s135647 (135 points)
Ah ok! Thanks for solving and explaining it. I get it now, sorry for such basic mistakes!
by SoSci Survey (305k points)
Nobody learns programming without making mistakes - that's what we have to online support for :)

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...