Completion Code Generation - gideongoldin/TurkGate GitHub Wiki

Upon proper completion of a survey, workers may obtain a completion code through TurkGate. To enable this, simply redirect your survey takers to the URL provided on the pop-out drawer in index.php, under the generated HTML code. Certain survey sites (e.g., Qualtrics, LimeSurvey) offer automatic redirection.

Generate

The scripts in this page will automatically generate a completion code. This code contains a worker's Mechanical Turk Worker ID, the name of the Group the survey belonged to, and a set of optional, custom-defined key-value pairs. The code also includes a hashing of the aforementioned elements with a private, random salt:

Completion

Both the Worker ID and the Group name are retrieved from previously set cookies (automatically), while the set of key-value pairs are retrieved from PHP's GET variable. For most purposes, you will not need to include custom key-value pairs. If you would like to, however, include something like a worker's browser information, you could do so by simply appending it to the URL in your redirection: http://yourexternalserver.com/youroptionalsurveypath/generateCompletionCode.php?version=safariForiOS

The format of generated completion codes is as follows:

w[Worker ID]g[Group name]v[value]:hashingOfAforementionedElementsWithSalt

The first half of the code (i.e., that preceding the colon), is a collection of key-value pairs, where the letters outside the brackets (e.g., w) indicate variables names and the strings inside (e.g., Worker ID) represent their values. As stated above, w[Worker ID]g[Group name] are generated automatically, while v[value] is optional and retrieved from the URL.

Any number of key-value pairs may be specified. Within these pairs, v is extracted as the first character in the GET array's variable (e.g., version), while value will comprise the contents of this variable (e.g., safariForiOS).

The second half of the code (i.e., that following the colon), is a hashing of the first half with a salt. Be sure to substitute your own salt in order to ensure proper security.