====== Working with External Panel providers  ======

If you recruit the participants of your survey through a panel provider, you have to work with IDs, backlinks, exit links and redirects. This section describes how to implement it with SoSci Survey elegantly. 

===== The meaning behind the many links  =====

If the provider of a panel pays a fee to the participants, he would like to know who has the questionnaire at all completed course. To this end, he must "follow" the individual participant. 

It works like this: Each participant will receive a personalized link. If one of the participant clicks this link, an identifier (ID or subscriber ID) is transmitted to oFb. At the end of the survey the oFb must now inform the provider that the participant has completed the questionnaire. And the identifier is in turn transmitted back to the provider. For this purpose one has to click the Back or Exit link. 

===== Personalized Links to the questionnaire  =====

The easiest way for the panel provider is to submit the identifier as a reference. For this purpose, the variable ‘‘r’’ must be attached to the link of the questionnaire. The address is then ‘’%%ServerURL/project/?r=Identifier%%’’, e.g. ‘’%%https://www.soscisurvey.de/demo/?r=Identifier%%’’. 

The provider will exchang the //identifier// for each participant. 

**Note**: If you do not want to call the standard questionnaire in the link, use the link only once the question mark (‘’?’’) and for other variables, the ampersand (‘’&’’), e.g. ‘’%%https://www.soscisurvey.de/demo/?q=fb2&r=Identifier%%’’. To create the links see also [[url | The link to the questionnaire]]. 

**Note**: If the provider wants to use a different variable necessarily instead of the variable ‘’r’’, then you only need two more lines of PHP code, which is below. 

===== Exit-links back to the provider  =====

In order to inform the participant identifier to the provider end of the survey, the participant is simply redirected to a website of the provider. Once again, the identifier is transmitted. 

Vom Anbieter erhält man üblicherweise einen Exit-Link der etwa so aussieht:\\ ''%%http://www.provider.com/p9815245/exit.php?id=Code%%''
Instead of the //code// you must now use the reference that you got in the beginning with each respondent. This can be done simply with the placeholder ‘’reference’’: \\
''%%http://www.anbieter.com/p9815245/exit.php?id=%reference%%%''

Now you have to only redirect the respondents - the so-called Redirect. You can use the function  ''[[:en:create:functions:redirect|redirect()]]''. However, this breaks the survey immediately and directs the participants to another page. So you have to insert a blank page itself before the end of the questionnaire, and paste the//PHP-Code/// and then the ''redirect()''command: 

<code php>
redirect('http://www.anbieter.com/p9815245/exit.php?id=%reference%');
</code>

You should put nothing else on this page. 

If one invokes the questionnaire with a test identifier and the link above (which you simply invent yourself), then you should be redirected at the end of the survey to the page of the provider and in the address line of the browser you should see the test-identifier. Probably you will get an error message from the provider, because the identifier is not valid. 

**Hint:** With the ''redirect()'' function participants can be also send away when the contigent is met. Whether the contigent has been met, you can, for example, check this by using the ''[[:en:create:functions:statistic|statistic()]]'' function.

**Important:** If a participant leaves the questionnaire with  ''redirect()'' then the questionnaire is marked as incompleted in the data record. To filter incomplete data records, you have to go back to the last completed page (LAST PAGE).

**Important:** If you want to use the placeholder ''%reference%'', then you must not prepare a placeholder named ''%reference%'' using ''[[:de:create:functions:replace|replace()]]''.

===== The provider uses a different variable as the "r"  =====

If the provider can not or doesn’t want to use r in the link or wants to set a variable such as susid, it is also pretty easy to solve. We read the variable for it on the first (!) Page in the questionnaire with  ''[[:en:create:functions:readget|readGET()]]'' and stores it as an interview variable. 

Like a placeholder for the links you have to specify the name of interview variable, of course. 

<code php>
// This code should be on page 1 
$id = readGET('Susid'); // ID Read (on page 1) 
set ($id, 'panelID'); // Save in interview variable 

// Optionally, you can also put the panel ID in the data record about the case
// Remain open for the settlement with the panel provider questions. 
put('IV01_01', $id); // The internal variable must be created in advance, see function put () 
</code>

<code php>
// PHP code for redirect 
redirect('http://www.anbieter.com/p9815245/exit.php?id=%panelID%');
</code>
