Welcome to the LimeSurvey Community Forum

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

Capture Referrer using JavaScript

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
2 years 7 months ago #219406 by blocka
Capture Referrer using JavaScript was created 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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #219413 by DenisChenu
Replied by DenisChenu on topic Capture Referrer using JavaScript

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
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #219449 by tpartner
Replied by tpartner on topic Capture Referrer using JavaScript
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.

Lime-years ahead

Online-surveys for every purse and purpose