42

I have created a Google Survey and I want to be able to pass URL parameters into the survey so that I can track where responses are coming from. Ideally these URL parameters will be populated into the spreadsheet.

I have tried something like this:

https://docs.google.com/forms/d/HASH/viewform?src=MY_SOURCE&ref=MY_REF

However, this doesn't seem to be working.

Any help or comments appreciated!

2

4 Answers 4

46

There is no way to pass hidden information, but you can pre-fill form fields using URL parameters:

  1. Open a form in Google Forms
  2. In the top right, click More [...]
  3. Choose Get pre-filled link
  4. Fill in any answer fields you want to pre-populate
  5. Click Submit
  6. To send the pre-populated form to respondents, copy and send the link at the top
6
  • 2
    Thanks, Eric. That would work if I could pre-fill a field and then hide it. Maybe it is possible :). Jan 13, 2015 at 15:07
  • 1
    @NathanLippi I have a feeling this would be possible using form scripts, but I cannot find a way to detect and save the param using the API developers.google.com/apps-script/reference/forms
    – Abram
    Sep 4, 2015 at 15:13
  • 2
    Can you pinpoint where it actually says that in the page you link? Please include the relevant information in your answer. Mar 24, 2017 at 14:15
  • 1
    Any way I can shorten prefilled url?
    – Vinay P
    Sep 19, 2021 at 17:32
  • @VinayP Have you found the answer? Nov 4, 2021 at 11:38
17

I came across this and decided to do the following.

  1. Create a form
  2. At the bottom add your own parameters (lets say user_id)
  3. Click the triple dots on the top right to get a prefilled link
  4. Fill the user_id parameter with user_id
  5. Click Generate and copy the link (Bottom left)
  6. Your link will look like this: https://docs.google.com/forms/d/e/1FAIplshiflshdlshdflkhlkb0Exboi5usdfsdf-f/viewform?entry.1370129364=user_id

In my case I wrote something that replaces {user_id} with the actual user id. The link looked like this: https://docs.google.com/forms/d/e/1FAIplshiflshdlshdflkhlkb0Exboi5usdfsdf-f/viewform?entry.1370129364={user_id} I did a simple replace (e.g user_id = 123455) link looks like this https://docs.google.com/forms/d/e/1FAIplshiflshdlshdflkhlkb0Exboi5usdfsdf-f/viewform?entry.1370129364=123455 and clicking on it will fill the user_id in the form with 123455

Do this if you don't mind the users to be able to change the data (most of them don't).

1
  • Yes, this method is works! that entry.{some_codes} can be seen by using Inspect Element Jun 7, 2022 at 2:08
12

I've wanted to pass through hidden information through a Google Form and came up with a little work around:

  1. Create a new page/section (old vs new forms) on the form with the questions that you want filled. If you have multiple pages, make the hidden page the last for simiplicity.

  2. Use the "continue to page" option on the last page/section you want visible to go to Submit.

  3. Use the prefill tool to get the entry IDs and set up the link as you need.

When a user accesses the form through the pre-filled URL, the hidden data will be filled in on the hidden page and submitted with their other answers... Although it will be hidden from an EU standpoint.

I use this frequently for transferring data from one form to another. With the CopyDown addon to copy the formula after each form submit so that it builds the pre-fill URL, that when clicked, has just the essential questions (i.e. record number, name, etc.) to verify the info. Hit Next, then Submit!

2
  • 14
    This doesn't seem to work. When you put "After section 1: Submit", the values in "Section 2" do not get pre-filled. It seems values get pre-filled only when shown. Mar 29, 2017 at 17:21
  • I can confirm it does not work, at least in 2022. What you get is always an empty field instead of a pre-filled answer. Would be good to at least prevent editing of an answer, even if it can't be hidden. May 7, 2022 at 2:15
0

There's yet another workaround that I just thought about.

Get your normal form with a prefilled link, with "wanted hidden" dat in the end. Copy the whole source code of the page and post the HTML to your webpage.

Then select the DIV in which you want to hide and ad style="visibility: hidden; max-heigh:1px;" It will hide the whole DIV and shrink the height to 1px.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.