Functions to access respondent properties
There are several functions that help you access respondent properties.
For all these functions, output is a string. If the variable is absent for the respondent, returns an empty string (which, if needed inside an algebraic function or another function that demands a number, is converted to 0).
GETvariable
Retrieves the value of a GET variable passed to Conjointly.
Signature: GETvariable(variable_name)
Examples:
GETvariable("var1")GETvariable("VAR1")orGETvariable("Var1")will render the same asGETvariable("var1")because GET variable names are case-insensitive
The simplified notation [var1] using square brackets only works in redirects) and is not part of the formula language.
Further examples are provided below.
| Formula | If the variable is empty | If the variable value is 13 | If the variable value is qwerty |
|---|---|---|---|
GETvariable("var1") | (empty string) | 13 (string) | qwerty (string) |
GETvariable("var1")==13 | FALSE | TRUE | FALSE |
GETvariable("var1")=="qwerty" | FALSE | FALSE | TRUE |
GETvariable("var1")=="" | TRUE | FALSE | FALSE |
GETvariable("var1")=="0" | FALSE | FALSE | FALSE |
GETvariable("var1")==0 | TRUE | FALSE | TRUE |
GETvariable("var1")==GETvariable("VAR1") | TRUE | TRUE | TRUE |
GETvariable("var1")+3 | 3 (number) | 16 (number) | 3 (number, because + does not work as a concatenator) |
respondentInfo
Retrieves certain types of information about the respondent (such as IP address or locale).
Signature: respondentInfo(information_type)
Examples are provided below.
| Formula | Value |
|---|---|
respondentInfo("id") | 12345 (string) |
respondentInfo("id")+0 | 12345 (number) |
respondentInfo("id")+1 | 12346 (number) |
respondentInfo("ip") | 12.12.12.12 (string) |
respondentInfo("var1") | (empty string) |
respondentInfo("") | (empty string) |
Below are all possible information types. Their availability depends on whether anonymisation is enabled for the study.
| Information type | Corresponding column in Excel exports | Available in the survey for piping when responses are anonymous | Available in the survey for piping when responses are not anonymous |
|---|---|---|---|
| id | Participant ID | ✅ | ✅ |
| dateTimeCreated | Datetime of participant creation | ✅ | ✅ |
| dateTimeEntered | Datetime of entering survey. It uses the responseBegin timestamp, not the actual time when the respondent saw the first frame of the survey. In case of a slow connection like 3G, the delay can be up to half a minute. | ✅ | ✅ |
| dateTimeFinished | Datetime of finishing survey | ❌ | ❌ |
| length | Length of interview in seconds (If used inside the survey, it will output the length of interview in seconds so far) | ✅ | ✅ |
| code | Code shown to respondents at the end of survey | ❌ | ❌ |
| ip | IP address | ❌ | ✅ |
| locationCity | Location: City | ❌ | ❌ |
| locationRegion | Location: Region | ❌ | ❌ |
| locationPostcode | Location: Postcode | ❌ | ❌ |
| locationCountry | Location: Country | ❌ | ❌ |
| locationLatitude | Location: Latitude | ❌ | ✅ |
| locationLongitude | Location: Longitude | ❌ | ✅ |
| device | Device type | ❌ | ✅ |
| isTouchEnabled | Is touch enabled on device | ❌ | ✅ |
| browser | Browser string | ❌ | ✅ |
| locale | Locale | ✅ | ✅ |
| referrer | Referrer URL | ❌ | ✅ |
For some information types, it may take some time to determine the value for a respondent while they are in the survey. For example, it may take a few seconds to determine the respondent’s location based on their IP address. In such cases (e.g. respondentInfo("locationLatitude") and respondentInfo("locationLongitude")), the function will return an undefined value early in the survey, regardless of the anonymisation settings.
externalVariable
Retrieves uploaded variables for the respondent.
Signature: externalVariable(variable_name)
Example: externalVariable("age")
segregation
Retrieves segregation value for a specific scenario for the respondent.
Signature: segregation(scenario_name)
Example: segregation("Scenario 1")