An anonymous ID is a random identifier an analytics SDK creates for one install so it can group a person's events before they log in. A user ID is the identifier your own system assigns once you know who they are. Switch from one to the other at login or signup.
What is an anonymous ID
An anonymous ID is a pseudo-unique value with no name or email in it, usually a UUID. Segment's Identify spec says it can be any pseudo-unique identifier and recommends UUIDv4 when you have none. Mixpanel's ID management guide says its auto-generated $device_id can be considered the anonymous ID.
ActivationPal works the same way. On first launch the Swift SDK generates a random device ID, stores it in app storage and sends it with every event. It does not collect a name or an email on its own.
That device ID is the anonymous ID. If you never tell the SDK who the person is, it is the only identity an event has.
Anonymous ID vs user ID
| Anonymous ID | User ID |
|---|
| Created by | The analytics SDK | Your app or backend |
| Exists from | First launch | Signup or login |
| After a reinstall | New value | Same value, if you set it again |
| On a second device | A different value per device | Same value on both |
| Should be | A random UUID | A database ID or UUID, never an email |
Mixpanel goes one step further: once you call identify, it relabels the earlier anonymous events with the user ID, so pre-login and post-login behaviour read as one stream.
User ID vs device ID in analytics
In ActivationPal the device ID is the anonymous ID, and user_id is an optional second field. Events recorded before you set a user ID carry only the device ID. Events recorded after carry both.
Both show up in the live feed and in get_user, which returns one device's full timeline plus the RevenueCat or Superwall events of every user ID that device reported.
When to switch from an anonymous ID to a user ID
Set the user ID at three moments:
- When the person signs up or logs in.
- When the app opens and they are already logged in. Mixpanel lists this as a best practice, so every event in the session carries the ID.
- When your purchase provider already knows them, so both tools use the same value.
An app with no accounts can still do this. Generate one UUID, persist it, and give the same value to every SDK, as the Superwall setup guide describes.
Never use an email. RevenueCat and Segment both advise against it. Mixpanel adds a practical reason: a user ID cannot be changed later, so a person who changes their email becomes a separate user. RevenueCat also caps app user IDs at 100 characters and blocks values such as guest, anonymous and null. See privacy and security for what the SDK collects.
Join RevenueCat or Superwall purchases with setUserId
RevenueCat events carry RevenueCat's app user ID. ActivationPal stamps each one with the last device that reported the same user ID, which puts the purchase on that device's timeline, in revenue by country and in funnel-to-revenue joins.
With RevenueCat, pass its app user ID at launch and again after login:
Purchases.configure(withAPIKey: "appl_YOUR_RC_KEY")
ActivationPal.configure(app: "myapp", key: "ap_pk_YOUR_KEY",
userId: Purchases.shared.appUserID)
// after the person logs in
Purchases.shared.logIn(account.id.uuidString) { customerInfo, created, error in
ActivationPal.setUserId(Purchases.shared.appUserID)
}
RevenueCat's own identifying customers guide recommends a random UUID, which is why the example logs in with one. Setup for the webhook is in the RevenueCat docs.
With Superwall, use one UUID for both SDKs:
let userId = account.id.uuidString
Superwall.shared.identify(userId: userId)
ActivationPal.setUserId(userId)
Without a user ID the rc_* purchase events still arrive and still total correctly. Timelines and funnel-to-revenue joins stay empty. For the events themselves, see RevenueCat webhook events.
What happens after a reinstall, logout or new device
Reinstall
Deleting the app clears its storage, so the SDK creates a new device ID on the next launch. RevenueCat behaves the same way: its anonymous app user ID is regenerated, and a custom ID is what lets you restore purchases without a manual restore.
After login and setUserId, the same user ID sits on both device IDs. Anything the person did before the reinstall is still under the old device ID.
Logout
setUserId(nil) in Swift, setUserId(null) in Kotlin and Flutter, and setUserId(undefined) in React Native clear the user ID. The device ID stays and no history is deleted.
RevenueCat's logOut creates a new anonymous app user ID, so call setUserId again with the provider's current ID. Mixpanel calls reset at logout so two people sharing a phone are not merged into one.
New device
A person who logs in on a second phone gets a second device ID and the same user ID. Purchases attach to the last device that reported that user ID.
Common mistakes
- Using an email as the user ID.
- Hard-coding one string as the ID. RevenueCat warns that every install then counts as the same user.
- Giving the analytics SDK and the purchase provider different IDs, which leaves purchases without a device.
- Calling
setUserId before the provider's login has finished, so it sends the old anonymous value.
- Using a non-UUID identifier with Superwall, which can break the device join.
To read a single person's path once the IDs line up, see user journey analysis.