Actions

Difference between revisions of "URL fields/en"

From LimeSurvey Manual

(Updating to match new version of source page)
(Updating to match new version of source page)
Line 1: Line 1:
 
<languages />
 
<languages />
 +
 
__TOC__
 
__TOC__
 +
 +
 +
=Introduction=
 +
 +
URL fields parameters can be used in the:
 +
* End URL field of the survey (see the [[Survey texts|survey texts wiki section]]);
 +
* URL field of the quota rule (read more about [[Survey quotas|survey quotas here]])
 +
* Start URL field of the survey.
 +
  
 
=End URL field=
 
=End URL field=
  
At the end of a survey, or when a quota causes a survey to terminate, there is the option of setting a URL. This URL is presented to the participant who has finished the survey on the completed page, or you can optionally set the participant to be automatically redirected to the URL.
+
At the end of a survey or when a quota causes a survey to terminate, there is the option to set an ending URL. This URL is presented to the participant who has finished the survey on the end page or you can optionally set the participant to be automatically redirected to the respective URL. This can be done by filling in the End URL option from the [[Survey texts]] panel and by enabling the automatic load of the end URL from the [[Presentation]] panel once a survey is completed .
 +
 
 +
However, there are a number of fields available to be used to enhance the functionality of this URL.
  
There are a number of fields available to be used to enhance the functionality of this URL.
 
  
 
==Basic fields==
 
==Basic fields==
  
You can use {SAVEDID}, {TOKEN}, {SID} and {LANG} (since 1.71+) in this URL.
+
You can use '''{SAVEDID}''', '''{TOKEN}''', '''{SID}''' and '''{LANG}''' in this URL:
* SAVEDID is the id assigned to this particular submission,
+
*'''SAVEDID''' is the id assigned to this particular submission;
* TOKEN is the token used to participate in the survey,
+
*'''TOKEN''' is the token used to participate in the survey;
* SID is the survey ID, and
+
*'''SID''' is the survey ID;
* LANG is the language code
+
*'''LANG''' is the language code.
  
'''Example'''
+
For example:
  
 
<code>
 
<code>
Line 24: Line 35:
 
==Answer fields==
 
==Answer fields==
  
You can also use {INSERTANS:SGQA} in this URL (since 1.82+).
+
You can also use '''{INSERTANS:SGQA}'''. This URL field allows you to add the response to a specific question in the survey into the end URL. This can be useful for sending a response to an external script (ie an email address collected during the survey).
* {INSERTANS: SGQA} allows adding the response to a specific question in the survey to the final url. This can be useful for sending a response to an external script (ie an email address collected during the survey).
 
  
'''Example'''
+
For example:
  
 
<code><nowiki>
 
<code><nowiki>
 
http://www.limesurvey.org/test.php?email={INSERTANS:1234X56X7}
 
http://www.limesurvey.org/test.php?email={INSERTANS:1234X56X7}
 
</nowiki></code>
 
</nowiki></code>
 +
  
 
==Expressions==
 
==Expressions==
  
You can also use any Expression Manager expression (since 1.92+).
+
You can also use any [[Expression Manager|Expression Manager]] expression here.
  
'''Example'''
+
For example:
  
 
<code><nowiki>
 
<code><nowiki>
Line 43: Line 54:
 
</nowiki></code>
 
</nowiki></code>
  
==Passthrough fields (LimeSurvey 2.x or later)==
+
==Passthrough fields==
 
 
Starting with version 2.0 you now have to define any additional parameters that should be passed to the end URL in the survey settings (Tab "Panel integration"). To use such a parameter in the end URL just insert the tag {PASSTHRU:<paramname>} where <paramname> is the name of your input parameter.
 
  
Example:
+
To use passhtrough fields, you have to define any additional parameters that should be passed into the end URL in the survey settings (read more about the LimeSurvey [[Panel integration|panel integration]] feature). To use such a parameter in the end URL, just insert the tag '''{PASSTHRU:<paramname>}''' where ''<paramname>'' is the name of your input parameter.
  
You defined in the Panel integration tab a parameter named 'foobar'. The survey is started with a link like
+
Let's suppose that you defined [[Panel integration|a parameter]] named "foobar". The survey is started with a link like
  
 
<code>
 
<code>
Line 55: Line 64:
 
</code>
 
</code>
  
where XYZ123 is the value you want to pass.
+
The XYZ123 is the value you want "to pass".
  
A survey end URL of <code><nowiki>http://www.limesurvey.org/test.php?foobarout={PASSTHRU:foobar}</nowiki></code> would then convert to <code><nowiki>http://www.limesurvey.org/test.php?foobarout=XYZ123</nowiki></code>
+
The end URL of a survey with the following URL <code><nowiki>http://www.limesurvey.org/test.php?foobarout={PASSTHRU:foobar}</nowiki></code> would then be converted to <code><nowiki>http://www.limesurvey.org/test.php?foobarout=XYZ123</nowiki></code>
  
==Passthrough fields (LimeSurvey 1.92 and older)==
 
  
You can also use a 'passthrough' field name and data value in the end URL.
+
{{Alert|title=Attention|text=Please note that the passthrough fields can be used only with LimeSurvey 2.x or later!}}
  
In some instances you may want to pass a value to the survey at initialization, and then have that value passed through to an external script at the end (for example a marketing firms subsid).
+
=Start URL=
 
 
'''Example'''
 
  
In this case you'd start the survey with the query url "index.php?sid=12345&passthru;=subsid&subsid;=9999".
 
 
In your URL you would use {PASSTHRULABEL} and {PASSTHRUVALUE} to reuse these values at the end of the survey.
 
 
A URL of "http://www.limesurvey.org/test.php?{PASSTHRULABEL}={PASSTHRUVALUE}" would then convert to "http://www.limesurvey.org/test.php?subsid=9999"
 
 
==Places to use URL fields==
 
 
URL fields can be used in the general survey exit URL (see [[Creating a new survey]] ), and in the URL setting for each individual quota (see [[Quotas]] ).
 
 
=Start URL=
 
  
 
==Prefilling a survey using GET parameters==
 
==Prefilling a survey using GET parameters==
  
You can prefill all answer except upload and equation question type. You can use [[Expression Manager#Access to Variables|qcode naming]] for the parameters and set the value for single question. For multiple question type, you must use [[SGQA identifier]]
+
You can prefill all answer except upload and equation question type. You can use [[Expression Manager#Access to Variables|qcode naming]] for the parameters and set the value for single question types. For multiple question type, you must use a [[SGQA identifier]].
  
Then answer are set to the prefilled value, for single choice option, you must use the code of the answer, for multi choice question, you must use Y if you want to check the answer.
+
Then answer are set to the pre-filled value, for single choice option, you must use the code of the answer, for multi choice question, you must use Y if you want to check the answer.
  
'''Example'''
+
Here are some start URL '''examples''':
  
 
* <code><nowiki>http://ls.example.org/1234?QTEXT=prefilled</nowiki></code> : Fill the question with code Q1 with <nowiki>'prefilled'</nowiki>
 
* <code><nowiki>http://ls.example.org/1234?QTEXT=prefilled</nowiki></code> : Fill the question with code Q1 with <nowiki>'prefilled'</nowiki>
Line 92: Line 87:
 
* <code><nowiki>http://ls.example.org/1234?1234X1X1SQ001=Y</nowiki></code> : Check the  sub question SQ001 at question  number 1 in group 1.
 
* <code><nowiki>http://ls.example.org/1234?1234X1X1SQ001=Y</nowiki></code> : Check the  sub question SQ001 at question  number 1 in group 1.
  
{{Hint|Text=GET parameters use ? for the first and & for subsequent parameters. If you already have ? in your URL, you must use & to add more GET parameters.}}
+
{{Hint|Text=GET parameters use "?" for the first parameter and "&" for the subsequent ones. If you already have "?" in your URL, you must use "&" to add more GET parameters.}}
{{Hint|Text=The extra GET parameters are only filled when the survey starts anew. Therefor, for testing, always add newtest=Y to start a fresh survey. For example: <code><nowiki>http://ls.example.org/1234?QTEXT=prefilled&newtest=Y</nowiki></code>}}
+
{{Hint|Text=The extra GET parameters are only filled when the survey starts anew. Therefore, for testing, always add newtest=Y to start a fresh survey. For example: <code><nowiki>http://ls.example.org/1234?QTEXT=prefilled&newtest=Y</nowiki></code>}}
 +
 
  
 
==Prefilling a survey using GET parameters using URL parameters tab==
 
==Prefilling a survey using GET parameters using URL parameters tab==
  
You can prefill, sometimes more easily, answers using URL parameters which can be configure in the [[Survey_settings#Panel_integration|survey settings - panel integration]].
+
You can prefill (sometimes easier) answers using URL parameters which can be configured in the [[Panel integration|panel integration]].
 
 
==Prefilling and hidding the answer==
 
  
You can use hidden avanced settings to hide the question to respondant. Prefilling is happen too.
 
  
==Before 1.92 version==
+
==Prefilling and hiding the answer==
  
Before 1.92 version, you must use SGQA and not directly the question code.
+
You can use hidden advanced settings to hide the question from your respondents. If so, the question still remains prefilled.

Revision as of 18:25, 25 January 2018

Other languages:
Deutsch • ‎English • ‎français • ‎日本語 • ‎Nederlands


Introduction

URL fields parameters can be used in the:


End URL field

At the end of a survey or when a quota causes a survey to terminate, there is the option to set an ending URL. This URL is presented to the participant who has finished the survey on the end page or you can optionally set the participant to be automatically redirected to the respective URL. This can be done by filling in the End URL option from the Survey texts panel and by enabling the automatic load of the end URL from the Presentation panel once a survey is completed .

However, there are a number of fields available to be used to enhance the functionality of this URL.


Basic fields

You can use {SAVEDID}, {TOKEN}, {SID} and {LANG} in this URL:

  • SAVEDID is the id assigned to this particular submission;
  • TOKEN is the token used to participate in the survey;
  • SID is the survey ID;
  • LANG is the language code.

For example:

http://www.limesurvey.org/test.php?var1={SAVEDID}&var2={TOKEN}&var3={SID}&lang={LANG}

Answer fields

You can also use {INSERTANS:SGQA}. This URL field allows you to add the response to a specific question in the survey into the end URL. This can be useful for sending a response to an external script (ie an email address collected during the survey).

For example:

http://www.limesurvey.org/test.php?email={INSERTANS:1234X56X7}


Expressions

You can also use any Expression Manager expression here.

For example:

http://www.limesurvey.org/test.php?gender={if(sex=='Male','M','F')}&name;={name}

Passthrough fields

To use passhtrough fields, you have to define any additional parameters that should be passed into the end URL in the survey settings (read more about the LimeSurvey panel integration feature). To use such a parameter in the end URL, just insert the tag {PASSTHRU:<paramname>} where <paramname> is the name of your input parameter.

Let's suppose that you defined a parameter named "foobar". The survey is started with a link like

http://example.org/limesurvey/index.php/survey/index/sid/12345/lang/eb?foobar=XYZ123

The XYZ123 is the value you want "to pass".

The end URL of a survey with the following URL http://www.limesurvey.org/test.php?foobarout={PASSTHRU:foobar} would then be converted to http://www.limesurvey.org/test.php?foobarout=XYZ123


Important.png
Attention : Please note that the passthrough fields can be used only with LimeSurvey 2.x or later!

Start URL

Prefilling a survey using GET parameters

You can prefill all answer except upload and equation question type. You can use qcode naming for the parameters and set the value for single question types. For multiple question type, you must use a SGQA identifier.

Then answer are set to the pre-filled value, for single choice option, you must use the code of the answer, for multi choice question, you must use Y if you want to check the answer.

Here are some start URL examples:

  • http://ls.example.org/1234?QTEXT=prefilled : Fill the question with code Q1 with 'prefilled'
  • http://ls.example.org/1234?1234X1X1SQ001=prefilled : Fill the sub question SQ001 of question number 1 in group 1 with 'prefilled'
  • http://ls.example.org/1234?1234X1X1SQ001=A1 : Check the answer 'A1' at the sub question SQ001 of question number 1 in group 1 .
  • http://ls.example.org/1234?1234X1X1SQ001=Y : Check the sub question SQ001 at question number 1 in group 1.
Notice.png
Hint: GET parameters use "?" for the first parameter and "&" for the subsequent ones. If you already have "?" in your URL, you must use "&" to add more GET parameters.
Notice.png
Hint: The extra GET parameters are only filled when the survey starts anew. Therefore, for testing, always add newtest=Y to start a fresh survey. For example: http://ls.example.org/1234?QTEXT=prefilled&newtest=Y


Prefilling a survey using GET parameters using URL parameters tab

You can prefill (sometimes easier) answers using URL parameters which can be configured in the panel integration.


Prefilling and hiding the answer

You can use hidden advanced settings to hide the question from your respondents. If so, the question still remains prefilled.