Capture Referrer using JavaScript

More
9 months 3 weeks ago #219406 by blocka
While I know there is a built in feature to capture referrer in the response table, I'm wondering if there is a way for me to use javascript in my first question to capture the referrer?

Please Log in to join the conversation.

More
9 months 3 weeks ago #219413 by DenisChenu

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 following user(s) said Thank You: tpartner

Please Log in to join the conversation.

More
9 months 3 weeks ago #219449 by tpartner
Yes, this script will work in the source of a short-text question as long as the question is placed in the first group and the welcome screen is not be shown.

<script type="text/javascript" data-author="Tony Partner">	
	$(document).on('ready pjax:scriptcomplete',function(){
 
		$('#question{QID} :text').val(document.referrer);
	});
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now