Identifying Users

It is necessary to uniquely identify users to track their journey within Superwall.

If you have access to your user object while configuring the SDK, you can pass it in with Paywall.configure(apiKey:userId:delegate:). However, Superwall doesn't need a developer provided user id to work. In the event that you call Paywall.configure(apiKey:userId:delegate:) without a user id, Superwall will generate a random app user id for you. This id will persist internally until you call Paywall.reset() or until the user deletes/reinstalls your app.

Later on, if you identify a user, Superwall will alias the user you identified to the random user we created on your behalf.

// after signing in / getting your user from your database

// when the user signs out
// after signing in / getting your user from your database
[Paywall identifyWithUserId:@"user_id"];

// when the user signs out
[Paywall reset];

πŸƒβ€β™€οΈ Don't forget to sign users out
Remember to call Paywall.reset() when your user signs out.

Best Practices for a Unique User ID

  • Do NOT make your User IDs guessable – they are public facing.
  • Do NOT set emails as User IDs – this isn't GDPR compliant.
  • Do NOT set IDFA or DeviceIds as User IDs – these are device specific / easily rotated by the operating system.
  • Do NOT hardcode strings as User IDs – this will cause every user to be treated as the same user by Superwall.

What’s Next