Provide custom code to each participant

Plus d'informations
il y a 2 mois 3 semaines #171826 par istewart6
istewart6 a créé le sujet : Provide custom code to each participant
I have a list of gift card codes that I want to distribute to my survey participants. If they make it to the end of the survey, they will receive a code. Can I upload/import the codes to LimeSurvey in order to do this?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171828 par Joffm
Joffm a répondu au sujet : Provide custom code to each participant
Hi,

if you use tokens you can use ATTRIBUTEs to provide a code.
Then each respondent will get a predefined code.

If you don't use tokens, or if you want to provide random codes, you can:
  • create a question of type huge free text,
  • enter all codes in a well defined format as "default answers", e.g. QW12ER BG5RTZ 45DFRE.
    You see each code starts at a multiple of 7 and is 6 characters long.
  • create a random number (rn) between 1 and the total number of codes
  • with functions like "substr" select the respective code like "mycode=substr((rn-1)*7,6)".

If there are further question don't hesitate to ask

Best regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Les utilisateur(s) suivant ont remercié: LouisGac

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171832 par istewart6
istewart6 a répondu au sujet : Provide custom code to each participant
OK! If I don't have a predefined list of participants, can I still assign tokens and attributes to the participants? Ex. each participant who clicks the URL is assigned a token that can be used to index into a gift code.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171839 par DenisChenu
DenisChenu a répondu au sujet : Provide custom code to each participant
I think the only solution is to create a plugin for such system

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171842 par istewart6
istewart6 a répondu au sujet : Provide custom code to each participant
Oh I see. I thought I would be able to upload the gift code file and dynamically retrieve a new code every time that someone finished the survey. Maybe that is asking too much.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171846 par holch
holch a répondu au sujet : Provide custom code to each participant
You would have to program this yourself. This is not part of LS out of the box. You can create a little php (or whatever script), that is called by the end url feature.

But the token approach would be of course the best way.

Those gift vouchers have predefined codes or could you generate those codes yourself?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171848 par Joffm
Joffm a répondu au sujet : Provide custom code to each participant
Well, without tokens my second idea works.

And to avoid doubles you could use the {SAVEDID} as ID to find the code.

See example:

Fichier attaché :

Nom du fichier : limesurvey...1367.lss
Taille du ficher :15 ko


Of course, works only activated.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171852 par istewart6
istewart6 a répondu au sujet : Provide custom code to each participant
I like your idea of retrieving codes by index but have two worries:

1. Someone could inspect the source code and copy all the query codes.
2. I would need to manually update the codes every time that the participant count hit the limit (e.g. 100 codes only last for 100 participants).

The best solution is the token method but I won't be able to pre-determine who my participants will be, which means that I can't assign them tokens.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171854 par holch
holch a répondu au sujet : Provide custom code to each participant
How do you recruit your respondents? How do they access the survey?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171856 par istewart6
istewart6 a répondu au sujet : Provide custom code to each participant
Great, thanks. I'll look into php scripts to handle this.

To answer your question, the codes are predefined which is why I wanted to upload a single file containing all the codes. You can generate them using an API but it's a bit complicated.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines - il y a 2 mois 3 semaines #171857 par Joffm
Joffm a répondu au sujet : Provide custom code to each participant
Okay, if you have more participants than codes, just use a random number to select the code.

I tried to avoid to provide a code twice.

Someone could inspect the source code and copy all the query codes.

Put the hidden question with the codes into a different group

Joffm

BTW: I also prefer a small php script which is called by end-url.
But of course I was not sure how experienced you are.


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Dernière édition: il y a 2 mois 3 semaines par Joffm.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171858 par istewart6
istewart6 a répondu au sujet : Provide custom code to each participant
All participants who access the URL will be able to take the survey.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171860 par LouisGac
LouisGac a répondu au sujet : Provide custom code to each participant

istewart6 écrit: Great, thanks. I'll look into php scripts to handle this.

To answer your question, the codes are predefined which is why I wanted to upload a single file containing all the codes. You can generate them using an API but it's a bit complicated.


I suggest you to have a look in the theme views, it should be the easiest way to do it or to write a plungin, as Denis suggested.

This view is the one rendering the final page after completion:
github.com/LimeSurvey/LimeSurvey/blob/ma.../content/submit.twig

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171861 par Joffm
Joffm a répondu au sujet : Provide custom code to each participant
Here an example for an open survey with less codes than participants.

Surely you can reformat of your list by some formulas or macros in EXCEL to be able to just copy and paste it to LS.

Best regards
Joffm

Fichier attaché :

Nom du fichier : limesurvey...7-27.lss
Taille du ficher :15 ko


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 3 semaines #171870 par Joffm
Joffm a répondu au sujet : Provide custom code to each participant
Hi,
here a different approach.

You don't like to have the code list inside the survey.

So I took the opportunity to try an ajax call.
In a question (Q1) of type "short free text" I inserted the following script:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
	$.post('https://www.myServer.com/directory/getCode.php', function(data) {
		$('#question{QID} input[type="text"]').val(data)
	});
        $('#question{QID}').hide();
});
</script>


The php-script "getCode.php":
Here I used a plain array to store the codes.
<?php
 
$codes = array (
"aaaaaa",
"bbbbbb",
"cccccc",
...
"yyyyyy",
"zzzzzz"
);
$numberOfCodes=count($codes)-1;
$random=rand(0,$numberOfCodes);
echo ($codes[$random]);
 
?>

Of course you can store the codes in a database and retrieve them by SQL; but the example should be short and easy.
Therefore thee are no error checks at all.

It was my first try with ajax calls in LS. So any improvement is appreciated.
Especially how to hide the question if it is in "question by question" mode.
Here I used "group by group" mode and had a second visible question in this group.

Best regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Les utilisateur(s) suivant ont remercié: LouisGac

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!