Fill participant table attributes through URL

More
1 year 1 month ago #191730 by asaha
i have created a participant table with 8 diff attributes [attribute_1, ... attribute_8}
I am trying to fill these attributes with some values, while having the survey set to be open for public registrating so that I can track the various traffic sources and campaigns.

is there a way to fill these attributes by passing them in a URl string say something like

limesurvey.com/index.php/781278?lang=en&...ttribute_1=mydayblog

so that i can store mydayblog under attribute_1 in participant table?
The topic has been locked.
LimeSurvey Partners
More
1 year 1 month ago #191734 by Joffm
What is the intention that you want to store in TOKEN_ATTRIBUTES?
If you pass the parameters you may grab it in a simple question of type "short text".

And how do you add the parameter if you

while having the survey set to be open for public registrating


Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
1 year 1 month ago #191736 by asaha
@Joffm main purpose of storing in token_attribute is to ensure that i can capture which campaign a new registartion came from.

the survey can only be taken after registration, and email validation, so it's important that i have a token table active.

I could have used a short field to capture, but then the email validation is not a possibility and also same email can be used multiple times to access a survey.

is there a way to write into token table of a survey?
The topic has been locked.
More
1 year 1 month ago #191738 by DenisChenu
There are no included solution, and i don't know existing workaround solution

You allow register : you can create a plugin
1. Put url params in session in manual.limesurvey.org/BeforeRegister
2. Put the attributes in beforeTokenEmail / type : register

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
1 year 1 month ago - 1 year 1 month ago #191753 by tpartner
You could load the URL parameters into the register form via JavaScript.

Something like this in your theme custom.js file:

function getURLParameter(name) {
	return decodeURI(
		(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
	);
}	
 
$(document).on('ready pjax:scriptcomplete',function(){
 
	if($('#register_attribute_1').length > 0) {
		$('#register_attribute_1').val(getURLParameter('attribute_1'));
	}
});


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:
Last edit: 1 year 1 month ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
1 year 1 month ago #191755 by asaha
Hi Tony,

this is what i am trying to do, but being unsuccessful so far. Do i need any kind of authentication to write into token table? or just making a change in theme js file will do the trick?
The topic has been locked.
More
1 year 1 month ago #191757 by tpartner
Try it. :)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The topic has been locked.
More
1 year 1 month ago #191758 by DenisChenu

DenisChenu wrote: …i don't know existing workaround solution

tpartner wrote: You could load the URL parameters into the register form via JavaScript.


Lol :)

Thank you Tony !

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
1 year 1 month ago #191770 by asaha
Hi Tony,

Your method worked, but this means I have to make the fields visible for the respondent. And show whatever I am capturing through the URL.

Is there any other possibility of doing this with attributes hidden
The topic has been locked.
More
1 year 1 month ago - 1 year 1 month ago #191773 by tpartner
Hide the input with CSS. Something like this in your custom.css file:

#register_attribute_1 {
   display: none !important;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 year 1 month ago by tpartner.
The topic has been locked.

Start now!

Just create your account and start using Limesurvey today.

Register now