Use url_param
to populate data from a URL parameter into a survey variable.
OSAMP. Oversample Identifier
type: radio
invisible: y
chapter: panel_data
cvalue: url_param('os') || 0
0. Sample
1. Over sample
Details
- To capture data from a survey entry link using
url_param
, set up a variable for each parameter.- To capture open-end data, for instance letters like in a name, use a
type: text
question. - To capture closed-end data, for instance a numeric value, use a
type: radio
question. - To capture multiple closed-end data options, use a
type: checkbox
question.
- To capture open-end data, for instance letters like in a name, use a
- Use the
url_param
expression withdvalue
orcvalue
to match and store the parameter value. - As with any
cvalue
expression,url_param
can be used with Perl conditional syntax ("if" and "else" statements). - Use
url_param
for variables anywhere in the survey. -
url_param
is not case sensitive.
Tip! For information on how to form your entry links to capture parameters, see Passing in parameters.
Additional examples
Open-end data
In this example, the original respondent ID 'oid' from another survey is passed through the survey entry link for a recontact survey. If the 'oid' parameter exists, its value is stored in QORIGINALID. Otherwise, QORIGINALID stores the current 'trans_id' (respondent ID) assigned.
ORIGINALID. Original ID from main survey
ap: n
csentrycalc: y
invisible: y
type: text
cvalue: url_param('oid') || $trans_id
Closed-end data
In the example below, the 'm' parameter in the survey entry link indicates the respondent's source: Client sample (1) or Panel sample (2). If the parameter 'm' is found, the relevant value will be stored at QSAMPLE, if not found, '0' will be stored instead.
SAMPLE. Channel parameter by URL - derived from link
invisible: y
type: radio
cvalue: if (url_param('m')) {url_param('m')} else {0}
0. No parameter
1. Client sample
2. Panel sample
Multi-select variables
To capture and store multiple values in a single variable, repeat the same parameter in the entry URL for each value. In this example, QPRODUCT is setup to accept multiple values if included in the link, such as options 1 and 3, representing "Toaster oven" and "Blender."
PRODUCT. Products Purchased type: checkbox invisible: y cvalue: url_param('t') 1. Toaster oven 2. Microwave 3. Blender
Comments
0 comments
Please sign in to leave a comment.