Google Surveys -- a way to pass URL parameters into survey?
Asked Answered
B

4

46

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!

Babineaux answered 8/1, 2015 at 16:13 Comment(2)
possible duplicate of How do you get URL parameters in a Google Form using Google Apps Script?Bluebill
Possible duplicate of this or this and also a possibly better fit for the Web Applications site such as this.Bluebill
G
50

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
Gipon answered 12/1, 2015 at 14:46 Comment(6)
Thanks, Eric. That would work if I could pre-fill a field and then hide it. Maybe it is possible :).Babineaux
@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/formsOverabound
Can you pinpoint where it actually says that in the page you link? Please include the relevant information in your answer.Prolate
Any way I can shorten prefilled url?Gild
@VinayP Have you found the answer?Bergmans
@ViktorBrešan I used iframe and programatically changing the url based on logic. Hope this helpsGild
S
23

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).

Sension answered 23/7, 2020 at 16:25 Comment(1)
Yes, this method is works! that entry.{some_codes} can be seen by using Inspect ElementVowelize
F
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!

Foundation answered 17/5, 2016 at 23:37 Comment(2)
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.Paraphrastic
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.Kenwood
A
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.

Antispasmodic answered 10/3, 2023 at 21:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.