|Written for||Scriptwriters and survey authors|
How can we be sure the email provided by the respondent is valid - that is not just following the email@example.com syntax but fully registered to a real address?
The classic way is to send an email to the respondent in which they are asked to click on a link. The link usually updates a database and that database is then read to ensure the address is live.
The Structure of the survey will look like this:
We will use the Seed as a unique respondent identifier to send parameters to an .asp page and to write / retrieve data to an external database. The seed is a unique number among all interviews across all surveys (in IT, a seed is a number used to generate random numbers - in Askia surveys, the Seed is actually used to uniquely define rotations in an interview).
Here we will use an MS Access DB but of course, it's better (as in more reliable and more scalable) to use a SQL server DB.
You need to create one table that we will call Recruitment with the following fields:
- id ( a unique ID generated by the database)
- seed - integer: our unique interview identifier
- Mail - string: the email address entered by our recuited panelist
- State - integer: panelists will have a value of 0 when the email is sent, the field will be set to 1 once the link on the email has been clicked
You then need to create a DSN called Respondent - a DSN is unique string mapping to a named database on a computer. Alternatively you could have used ADO. Let's go through the structure of our survey:
- The "seed" question will be used to store the unique identifier of the interview. If you want something absolutely foolproof, you could also have used the GUID which is a unique string generated for each interview To populate the Seed variable we used a set value routing from the Recruitment chapter with a value if true:
- The "mail" question will be used to store the email given by the respondent in our survey where we also check that it follows the
- The checkDuplicate will be used to check if the email already exists in the database. If that's the case, we won't allow the respondent to continue. This is achieved by having a SQL import of that question. We run the query
SELECT Id FROM Recruitment WHERE Mail='??Mail??'and if checkDuplicate has a value > 0, we know we have a duplicate in our database. In this example a message is displayed and the survey should be abandoned there.
- We use a Start query routing to create the record in the database - initialising the record for this interview and ensuring the State field is at 0
INSERT INTO Recruitment (Seed, Mail,State) VALUES (??Seed??, '??Mail??',0)
- We use a "Send e-mail" routing to send this We are referring to an asp page called setValidation.asp (which is contained in the resources) and will be uploaded in the survey resources directory
- Here is what the setValidation.asp file looks like: This is quite bare but what we do is simply change the value of State for the record which has the matching value for "seed"... and we show a polite message asking them to close the window.
- And here is the content of the getValidation.asp page: