How to check if user is coming first time or second?

What is the best way to check if user is coming first time or second. I am currently using localstorage to make some decisions but when app is auto updated in user’s device, it clears all localstorage entries.

Any help would be highly appreciated.

Why not writting it in your servers database ?