title: Google App Script - Why is getTemporaryActiveUserKey() returning the same value for unique users
body: <p>I have created a contact type form using Google App script and published as a Web App. </p>
  
  <p>As I need to determine that the users filling in the form are unique I have used the <a href="https://developers.google.com/apps-script/reference/base/session#getTemporaryActiveUserKey()" rel="nofollow noreferrer">getTemporaryActiveUserKey()</a> function to get the users  unique key and save it to a spreadsheet alongside the rest of the form data. </p>
  
  <p>However there has now been a number of instances where the script has returned the identical key for multiple different users. I know for a fact these users are using different browsers and are in completely different locations. </p>
  
  <p>My question is, how is this possible?</p>
  
  <p>Below is the function in code.gs which runs when the form is submitted which retrieves this value</p>
  
  <pre><code>function postFormDataToSheet(form){
    var responseSheet = SSDoc.getSheetByName("Results");
  
    var time = new Date()
  
    var userKey = Session.getTemporaryActiveUserKey();
    var resultRow = [time,form.user_name, form.user_email, form.sheet,userKey]
    responseSheet.appendRow(resultRow);
  }
  </code></pre>
  
  <p>And the JavaScript Function in the Form HTML which calls the above Function when the submit button is pressed</p>
  
  <pre><code>$(function(){
    $('#submitButton').on('click', function(){
      google.script.run.withSuccessHandler(SuccessPage).postFormDataToSheet(this.form);    
    })
  })
  </code></pre>
  
  <p>Webapp is published with the following settings</p>
  
  <pre><code>Execute the app as: Me (myemailaddress)
  
  Who has access to the app: Anyone, even anonymous
  </code></pre>