It is important to uniquely identify users to track their user 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 Paywall.identify(userId: "\(user.id)") // when the user signs out Paywall.reset()
// 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.
- 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.
Updated 3 months ago