Capture URL from page where embedded survey is answered?



I’m playing around with a very basic feedback form that I’d like to embed on the bottom of all our pages. I’d like the form to automatically capture the URL of the page that the user is on when they complete the form (so I know what page they’re giving feedback on, without them having to copy and paste the URL).

Could someone tell me how? I’ve played with Merge Codes but can’t seem to find one that works!




Justin Prevatte answered

    I think that tracking links would work do the job for you.  Just create a link for each page.  You can get details in the SurveyGizmo documentation –

    anagle159845 commented
      • Ah thanks! I was hoping for something that didn’t need me to create something new for every page (we add lots of new content every day…)


      Here’s what I just did.

      1. Use an “Action” to create a hidden value with value “pageUrlGoesHere”.
      2. Use another “Action” for JavaScript after the hidden value.
      3. I used the below JavaScript & jQuery to set the hidden value to the URL.

      var myUrl = [location.protocol, ‘//’,, location.pathname].join(”);
      jQuery(‘.sg-question-set input[value=”pageUrlGoesHere”]’).val(myUrl);

      Good luck.

      Justin Prevatte answered

        You could run a JavaScript to get the current URL [window.location.href], and then use the sgapiSetValue function to place the response into an admin-only question.

        Jim Wetherill answered


          Question stats

          • Active
          • Views8809 times
          • Answers3 answers
          • Followers1 follower