Hey @asindhu ,
Every time configure is called without a defined user ID, an anonymous ID will be created. We have a document going over this in more detail which could be found here: https://www.revenuecat.com/docs/user-ids#what-is-a-customer-in-revenuecat
This might be hard to track down on why this is happening, but what could possibly be happening is that you're not aliasing these users, so each user that restores or redownloads the app is not being aliased with there old ID causing them to appear as two different users. For more information on this, I recommend looking into our document here: https://www.revenuecat.com/docs/restoring-purchases
Hi @Michael Fogel, thanks so much for your reply. Just want to make sure I understand what exactly is meant by your response:
Every time configure is called without a defined user ID, an anonymous ID will be created
Even though it’s not explicitly stated, my read of the documentation is that the first time configure() is called without a user ID, a new one is created. But it specifies that then, that anonymous user ID is cached on the device, so what I am assuming is that the next time the app is launched and configure() is called, the same cached ID is retrieved in that case. Am I wrong about that? As in, are you only supposed to call configure() once?
In that case I have to make some sort of check myself and somehow retrieve that cached anonymous user ID, which I don’t see how to do from the docs.
My app is already published with a handful of paying customers and from my own tests I know that the paid subscription status does get tracked correctly across app launches, so I’m hoping that I’m not making some really basic error of fully resetting the anonymous customer ID on each launch, as that would be really problematic!
Anyway if you could clarify this for me that would be super helpful. Thanks again.
Even though it’s not explicitly stated, my read of the documentation is that the first time configure() is called without a user ID, a new one is created. But it specifies that then, that anonymous user ID is cached on the device, so what I am assuming is that the next time the app is launched and configure() is called, the same cached ID is retrieved in that case. Am I wrong about that? As in, are you only supposed to call configure() once?
Correct, sorry for my wording there. Yes, you will only want to call configure once. After configuration, the same instance is shared throughout your app by accessing the .shared
instance in the SDK. If you don't provide an App User ID when configuring the Purchases SDK, RevenueCat will generate a new random App User ID for you and cache it on the device. In the event that the user deletes and reinstalls the app, a new random App User ID will be generated. I mis-worded it previously, but that anon ID will be cached on the device, I was more referring to if you are accidentally calling configure more than once.
Hope this helps!
Got it, thanks again Michael. Sorry but I just want to make 100% sure I understand because my wording was also not super precise -- you call Purchases.configure
once per app launch and not once per customer lifecycle, correct? Meaning, the call to Purchases.configure
will perform the logic needed to determine whether there is a cached user ID on the device or whether to create a new one, and this is all transparent to me as the user of the SDK? So, the intended use of the configure call is once, every time, on app startup, yes?
Or is it that every time you call Purchases.configure
, a new anonymous ID is created no matter what, and I need to have some sort of check to retrieve a cached ID from somewhere else?
So, the intended use of the configure call is once, every time, on app startup, yes?
Correct! You should only configure Purchases once, usually early in your application lifecycle. After configuration, the same instance is shared throughout your app by accessing the .shared
instance in the SDK.
Great, thanks so much for your help! Haven’t yet gotten to the bottom of the double-counted users but will keep digging with the above information.