Assign pre-generated username and password to participants | XM Community
Skip to main content

I am using an anonymous link to recruit 1000 survey participants from the web.
I want to provide each participant with a unique username and password that has been pre-generated. Of course, I do not want two (or more) participants to have the same username and password.
I have considered uploading the username and passwords in a contact list, but I do not have a way to link the usernames and passwords in the contact list to each individual participant because the recruitment will be anonymous.
To link the usernames and passwords to each participant, I have considered assigning the 1000 pre-generated usernames and passwords with a unique value between 1 and 1001 and subsequently assigning participants to a unique embedded data field value between 1 and 1001 when they enter the survey. I would then be able to provide each participant with the unique username and password that the value is associated with.
However, the only way I know to do this would be to use the random integer function, and I do not know how to guarantee that the values assigned to each participant do not repeat (i.e. two participants are both assigned the number 137, for example).
Does anyone have any ideas about how to accomplish this goal? It would make my research project possible. Thank you!

TomG Sorry to bother you, but I know you have a lot of experience. Do you have any suggestions to solve this problem?


Jon,
I would first create a database table with the required number of usernames. Then create a web service that selects an unused username, generates a password, updates the username record with the password, and outputs the username and password in a json string. Call the web service from the survey flow to populate embedded data fields with username and password.
This requires web server to host the script and database table.


Thanks TomG. This is likely the best solution and I will look into it.
I wanted to run another idea by you and see if you think it might work.
The idea is to assign each participant to a unique identifier that can be known ahead of time, and to save the identifier as an embedded data variable. For example, participant 1 would be assigned a unique ID of 1, participant 2 a unique ID of 2, and so forth.
If I know that I will be able to uniquely assign participant 1 through participant 1000 a unique ID of 1 - 1000, I can upload a contact list containing the username and password (both of which I have pre-generated) with an associated unique ID. I can then authenticate based on this unique ID, and pipe in the associated username and password.
In a prior post, one person suggested nesting a set of embedded data variables (one for each unique ID) under a randomizer with "Evenly Present Elements" selected to uniquely assign the known set of IDs to each participant. However, with 1000+ participants (it may even be 2000+), this would be quite tedious.
I was wondering whether there is some JavaScript that could serve the same purpose? Do you think something like that could work?


https://community.qualtrics.com/XMcommunity/discussion/comment/42188#Comment_42188Generating unique random keys is rather tricky and in order to limit the chance of duplicates, tend to be long. So, if you want a unique username without using a web service you might as well use the Qualtrics response id. Just assign it in the survey flow:
username = ${e://Field/ResponseID}
The password can be a random number, or if you don't want to use numbers you can use JS to generate one.


https://community.qualtrics.com/XMcommunity/discussion/comment/42190#Comment_42190That makes total sense. That said, I think I may have miscommunicated what I hope to accomplish.
The username-password pairs have already been created by a third party. Now, I want to provide a username-password pair to each participant to allow them to log-in to the third party's platform. It doesn't matter which username-password pair a participant receives, as long as two (or more) participants don't receive the same pair.
To provide participants with a username-password pairs, I had considered using a contact list. However, because I'll be recruiting using an anonymous link, I have no authenticating variable to connect each participant with a username-password pair on the contact list.
So my hope was to create this authenticating variable in the survey (such as randomly assigning an embedded data variable with a unique value of 1 - 1000 to each participant), with the values of 1 - 1000 associated with each username-password pair. That way, if a participant was assigned a value of 75, for example, I could pipe in the username-password pair associated with the value 75 in the contact list.
However, this randomization method seems tedious, because I'd need to create 1000(+) embedded data field elements. So instead, I'm wondering whether JavaScript could be used to accomplish a similar goal — i.e. assign a unique, pre-known value (such as 1 - 1000) to each participant.


https://community.qualtrics.com/XMcommunity/discussion/comment/42200#Comment_42200A contact list is far from the ideal choice for this since a response only has access one contact record. The only way to access all the contacts would be to use the API. Since you are trying to avoid using a web server and you would need to process the contact data returned by the API, the only way to do would be with JS and ajax. It wouldn't be easy and there are some potential security concerns.
My original answer is the better way to go.


https://community.qualtrics.com/XMcommunity/discussion/comment/42201#Comment_42201Thanks for your help TomG!


Leave a Reply