Welcome to the LimeSurvey Community Forum

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

Capture Referrer using JavaScript

More
4 years 3 days 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?
The topic has been locked.
More
4 years 3 days 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 support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: tpartner
The topic has been locked.
More
4 years 2 days 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.

Code:
<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
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose