Answered

Random Number Generator


Userlevel 3
Badge

how do you create a random number generator at the end of a survey in typeform?  

icon

Best answer by john.desborough 6 July 2021, 18:16

View original

15 replies

Userlevel 7
Badge +5

Hey @EcomGuy. Welcome to the Typeform Community! :hugging:

 

What would be the use case of this generated number? Having this information, I might be able to have some workarounds to share. :) 

Userlevel 3
Badge

Hi Mariana,  thank you.  So at the end of the typeform, when a user completes the survey, i’d like to be able to generate a random number or code.  This will be used for them to mark it complete in a 2nd system we have.

I need to do the same thing to integrate my Tyepform survey with Mechanical Turk. Basically, I need to give each respondent a random code at the end of the survey so that they could enter it in Mechanical Turk as a method to validate they’ve taken the survey and are eligible to be paid.

Userlevel 3
Badge

I need to do the same thing to integrate my Tyepform survey with Mechanical Turk. Basically, I need to give each respondent a random code at the end of the survey so that they could enter it in Mechanical Turk as a method to validate they’ve taken the survey and are eligible to be paid.

Typeform doesn’t seem to understand a lot of survey’s are done under anamitity as with MT.  Please let me know if you figure a workaround.  I’m at the point of looking for another option if they do not release easy functionality to generate end of survey codes to be used to close our MT surveys. 

Userlevel 7
Badge +6

@EcomGuy - i put an answer to your comment in this thread, over here in this other thread - it’s actually not that difficult to create something as a workaround while we wait for the product team to determine when they might be able to incorporate this into the code itself. 

 

 

Userlevel 3
Badge

@EcomGuy - i put an answer to your comment in this thread, over here in this other thread - it’s actually not that difficult to create something as a workaround while we wait for the product team to determine when they might be able to incorporate this into the code itself. 

 

 

Since you replied the same on  my post, I will reply the same to each one of your replies... Having the end user make their own code is not going to cut it. Frankly, it is the best way for us to just throw our market research dollars out the window in the paid survey world.   Sadly too many folks come in to a paid survey to get quick $$ and give bogus answers.  We need to have survey taker accountability with trace back codes we generate.  This is how we remove bad data and reject/block bad actors.  Bad actors will game the system with your “workaround”.  Let’s move on from AOL 2.5 and get us a random codes generator so we can confirm and approve completed good work by our survey takers.  Thank you!

Userlevel 7
Badge +6

lol.. understand the need.. just saying that you control the logic behind the type of ‘generator’ i put together so you are generating the random code - the logic rules can be updated from time to time to whatever you want. 

tell me how the bad actor will game the system with the work around? they enter a random number in, the back calculates a response and places it on the ending page after submission. You receive the same random response in a variable that you can use to match up to the code they input into MT.. 

so if your logic rules for completion of the survey to the end point ensure that they are providing the answers you want, then matching code they receive to input into MT with the code you have against that survey seems to be an easy solution. 

since you are seeding the calculation that drives out the code to the user, you are still driving the response. 

what work around do you suggest in the meantime? 

Userlevel 3
Badge

John… Sounds like you are not familiar at all with how survey farms such as Survey Junkie, MTurk, etc. work.  Folks come in as “John Doe” survey takers to us requestors on those sites.  They are not our clients, but rather we pay the survey farms to send them our way through their site.  Think craigslists of surveys.  We also pay for the data provided/completed by the anon survey taker. We have no way to communicate or identify survey taker, thus we can’t reject them or bad data by bad actors because we don’t have unique confirmation codes to keep them honest due to the annaminity of these sites.  See attached in MTurk - it is the last screen the survey taker completes after they are done in typeform.

From there we have a day to reject the data or it is auto-approved.  If they did their own code “workaround” , they will game the system to get paid for not doing more than 10 seconds of clicking randomly answers on our typeform.  We the folks paying them would like to be in a position to reject bad “complete” survey takers and easily remove bogus data when we see a code does not match up to the random one provided here in typeform.  Again, basis stuff.  Stunning it is not part of typeform yet. 

Userlevel 7
Badge +6

so .. as long as they receive a randomly generated code  from somewhere it should be fine?? 

(and yes i am familiar with the survey farms you mention)

did you actually enter a number into the test form i posted or just bounce off the front page? I just changed it from showing up as a statement page to showing up on an ending page. I am not certain you are getting what i am trying to demonstrate: add that type of question into your typeform sequence somewhere and it will generate a (pseudo)random number - the user is NOT doing a work around, they are providing the seed to create the random number

Userlevel 3
Badge

🤦🤦🤦You’re missing the point or trolling at this point.   Kindly ask you not to reply back as your answer is not the fix.  John Doe survey taker just wants to get paid.  He is not going to make up a random answer to your random question to provide a completion code.  He knows the game and 💯 will NOT copy that same code over as the completion confirmation # to ensure the case to reject his survey taken payout .

Userlevel 7
Badge +6

sorry but i will reply - not trolling, trying to provide a possible solution. if you are unwilling to say thanks for trying to help, well i pity your sense of propriety. 

if all you want to do is complain about a feature that is not available and not consider a volunteer trying to help provide some alternative thinking to help YOU solve a problem, then the troll might be you. 

no news about how generate a number random in email to respondents?

Userlevel 7
Badge +5

Hi @fxdavis Thanks for stopping by the community. This isn’t a feature we offer in our forms, but I would definitely utilize the workarounds above!

I’m looking for something similar but with text.  I have a list of 20 phrases, which I would like to be served to my workshop participants at random. In real life, I have each phrase written on its own index card and each participant gets a card, then works on an activity related to that card. (Later, they trade cards with another participant and work on that second phrase)  

I’m looking for a virtual equivalent.  Essentially, click on the typeform link, get served a phrase at random. Click again, get served another phrase. 

Some things I’ve tried already: 

→ I’ve looked at creating a first question like “pick a color” and then based on the answer, logic drives you to one of the 20 phrases.  But I’d like to eliminate the “pick a color” question as it’s a time waste. 

→ I’ve also looked at using hidden fields to assign a question based on last name, but don’t want to have to send a different link to every participant.

 

Any help is much appreciated! 

 

how do you create a random number generator at the end of a survey in typeform?  

Here’s a workaround that might fit what you need:

  1. Create a hidden variable in your typeform (e.g. tf_user_id)
  2. Generate a random user ID on the page that embeds your typeform
  3. Pass the random ID into your typeform
  4. (Optional) Redirect a user to a URL that includes the hidden variable as a parameter, in case you need to use it later

The code below should do the trick.

<div id="typeform-div"></div>
<script src="//embed.typeform.com/next/embed.js"></script>
<script>
  // Generate a random ID
  const timestamp = new Date().getTime();
  const randomNum = Math.floor(Math.random() * 1000000000);
  const randomId = `${randomNum}`;

  // Create a new div element with the random ID
  const divElement = document.createElement('div');
  divElement.setAttribute('id', randomId);
  divElement.setAttribute('data-tf-widget', 'YOUR_TYPEFORM_ID_HERE');
  divElement.setAttribute('data-tf-opacity', '100');
  divElement.setAttribute('data-tf-iframe-props', 'title=Your Typeform Title');
  divElement.setAttribute('data-tf-medium', 'snippet');
  divElement.setAttribute('data-tf-hidden', 'tf_user_id=' + randomId);
  divElement.setAttribute('style', 'width:100%;height:500px;');
  

  // Append the div to the "typeform-div" div
  const typeformDiv = document.querySelector('#typeform-div');
  typeformDiv.appendChild(divElement);
</script>

Reply