I have created a contact type form using Google App script and published as a Web App.
As I need to determine that the users filling in the form are unique I have used the getTemporaryActiveUserKey() function to get the users unique key and save it to a spreadsheet alongside the rest of the form data.
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.
My question is, how is this possible?
Below is the function in code.gs which runs when the form is submitted which retrieves this value
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);
}
And the JavaScript Function in the Form HTML which calls the above Function when the submit button is pressed
$(function(){
$('#submitButton').on('click', function(){
google.script.run.withSuccessHandler(SuccessPage).postFormDataToSheet(this.form);
})
})
Webapp is published with the following settings
Execute the app as: Me (myemailaddress)
Who has access to the app: Anyone, even anonymous