Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to dynamically create new tokens and start survey by single URL?

  • valentinyaroshinsky
  • valentinyaroshinsky's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago - 7 years 8 months ago #139362 by valentinyaroshinsky
I need to start surveys with possibillity of creating new participants dynamically .
For example by the following URL:
server/limesurvey/index.php?r=survey/index/sid/261933/email/ww@ww.net/lastname/leonadro/lang/en/newtest/Y

System will create new record in token table with email=ww@ww.net; lastname=leonadro
In case if customer with this email exists in the table - system will show his survey ( for example uncomplited)

The best option if I can pass some data into URL from external system - CustomerID,Name, Sex, City - these will automatically create new data in tokens table.
Problem is that I don't know list of participants before the survey and I need to generate records dynamically.

Thanks for any advices.
Last edit: 7 years 8 months ago by valentinyaroshinsky.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #139463 by Joffm
Hi, valentinyaroshinsky,
if I had to do it I would do it like this

You do not know the participants of the survey. How do you find them?

Well, create some "registration page" for the participants, where they enter name, email, and maybe some further attributes.
These information you can send by SQL to the LS token table "...token_[SurveyID]".

If email doesn't exist, create a new record in token table.
Your registration page has to create a unique token for each new participant.
Creating a unique token is easy: take a fixed token and add just the ID of this new respondent. This ID is auto increment.

If email exists read token from token table.

Afterwards your page will refer your participants to the survey page by the link
" www.server.com/limesurvey/index.php/ [SurveyID]?token=[token]"

If you hide the welcome page this will lead the participants directly from registration to the first question of your survey.

Of course this needs some skills in HTML, php and SQL.

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: valentinyaroshinsky
The topic has been locked.
  • valentinyaroshinsky
  • valentinyaroshinsky's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #139474 by valentinyaroshinsky
Thank you, Joff
I found workaround already - I use anonymized survey and URL Panel ( to pass additional Customer parameters).
In this case we can start survey directly
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #139510 by DenisChenu
Yep,

Working with url param.

If you really need a better solution : you can hack framagit.org/SondagePro-LimeSurvey-plugin/replaceRegister

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
7 years 5 months ago - 7 years 5 months ago #143730 by teracomp
I think I have a similar implementation on the front end plus some questions about the end URL:
  1. My website collects registration information from the user
  2. Sends an email with link that includes the token and some passthru vars: ?token=THETOKEN&userid=NNN&key=NONCEKEY
  3. The user clicks the link and begins the survey
    • The userid and key are mapped with the Panel Integration to hidden questions to store the data
    • Nine (9) equation fields are used to summarize each group to simplify post-processing
  4. At the end of the survey, the end URL sends them back to my site with results using the same passthru vars AND equation questions:
1. Is this the most effective way to passthru values AND equation fields as {INSERTANS} with the End URL? Perhaps it would be better to create a single equation that concatenates the 9 group totals so I have one param to process on the other end??

2. Is it better to return the SAVEDID (and passthru vars) then use the api::export_responses to get equation fields values?

Sorry if I'm hijacking the question. Just seems like BOTH ends are important: start with link and end with link.

The more I read about LimeSurvey the more I'm impressed with what you have done. This is an amazing platform!!

Dave Phillips
Last edit: 7 years 5 months ago by teracomp.
The topic has been locked.
More
7 years 5 months ago #143737 by teracomp
Quick update:
Since I'm using AngularJS for my Single Page App, my End URL is pretty clean:
This:
http://~~/app/#/submission/{SAVEDID}/{PASSTHRU:key}/{PASSTHRU:userid}/{INSERTANS:171768X7X44}/ (etc)

Should produce this:
http://~~/app/#/submission/123/GDEDS11882FFDD/446/231/242/253/324/315/326/237/238/239/

Which is read by my controller to parse each of the groups with ease since. I was really concerned about the length of the URL, but this looks quite manageable.

Please let me know if I'm missing something.

Dave Phillips
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose