Random user ID by hashing imei?

I am trying to implement a longitudinal survey that respondents will access from their mobile phone (in an application that I have written). I would like a unique user ID so that I can link submissions that come from the same respondent, but I do not want this to contain any personal information. Ideally this would simply be a random UUID generated on the phone. Is there a way for me to insert such an ID into the form through a webview?

Alternatively is it possible to collect a hashed value of the user’s imei code? For example, could I use deviceid in the XLSForm but then hash it and collect only the hashed value?


Hi @johnrbpalmer,

Are you planning to use the web form to collect data from the respondents or the Collect android app?

Have a great day!

just also take care of an upcoming change:

1 Like

Thanks, I am planning to use this in a mobile phone application that will run on both Android and iOS. My idea is to let users access the survey through a webview and I want to the survey to collect a unique identifier for each user that does not contain personal information.

I have just been experimenting with the digest function (https://docs.getodk.org/form-operators-functions/#utility). My idea was to have a deviceid field and then calculate the hash of this. But I am getting an error when I try to use digest:

FormLogicError: Could not evaluate: digest( /model/instance[1]/data/this_deviceid , SHA-256, base64), message: Function "{}digest" does not exist.

Hi @johnrbpalmer,

Would you mind sharing your xlsform with the community (deleting all the other variables and keeping only the required variables) so that we could have a look at our end and see if we could provide any inputs.

Have a great day!

Sure - here it is:

user_id_testing.xlsx (42.1 KB)

Hi @johnrbpalmer
Not to belabor what you had seen, I get the same error too when I try to upload your form.

I have looked at the form and digest function is not supported on the platform.


1 Like

3 posts were split to a new topic: Generating a random UUID in the mobile phone application and then insert it into the form using javascript within the webview