Overview
By default, SpendOwl uses an anonymous device ID to track attribution and purchases. When you set a user ID, all events are associated with that user, enabling:- User-level ROAS analysis
- Cohort tracking across devices
- Accurate LTV calculation
Setting User ID
CallsetUserId() after the user logs in or registers:
- SwiftUI
- UIKit
Clearing User ID
CallclearUserId() when the user logs out:
Best Practices
Use Stable Identifiers
Use Stable Identifiers
Use your internal database ID or UUID, not email addresses or usernames which can change.
Set Early, Clear on Logout
Set Early, Clear on Logout
Set the user ID as soon as authentication succeeds. Clear it immediately on logout.
Handle Session Restoration
Handle Session Restoration
Set the user ID when restoring a session from keychain/token:
Anonymous ID Behavior
When no user ID is set, SpendOwl uses an anonymous ID:- Generated on first launch
- Stored securely in Keychain
- Persists across app reinstalls (if Keychain is preserved)
- Replaced by user ID when
setUserId()is called
User ID in Attribution
The user ID is included with attribution data:User ID in Purchases
Purchases are automatically tagged with the current user ID:If the user ID changes during a purchase, the ID at transaction time is used.
Multiple Accounts
If your app supports multiple accounts:Privacy Considerations
- User IDs are transmitted securely over HTTPS
- IDs are hashed before storage in SpendOwl’s database
- You can request user data deletion through the dashboard
Next Steps
Purchase Tracking
Learn about automatic purchase tracking
Privacy
Privacy manifest and compliance