Skip to main content

We recently switched from Posthog to Amplitude. We don’t use the Amplitude SDK; instead, we use the Rudderstack SDK in cloud mode + the Amplitude Experiments SDK.

With Posthog, we had to reset the anonymousId on logout. However, there’s no anonymousId in Amplitude. We only have the deviceId. What should we clear on logout? And should we clear the deviceId?

----------------------------------------------------------

So, here’s some context:

  1. We don’t require an account to browse our app/website, except to checkout. So users usually browse logged out, and then sign up/sign in at the last step.
  2. Users may (and do) sign into multiple accounts (not at the same time!). They sign into one account, purchase, sign out, maybe browse a bit, then sign into a different account, make another purchase, ... Even though it’s the same device, we can’t treat them as the same person. This behaviour is normal and sufficiently expected for our product, and we must indeed consider them different people.
  3. Events produced while a user is signed out should be merged into the user that signs in later, not the user that signed out.

Thank you!

According to https://amplitude.com/docs/data/sources/instrument-track-unique-users, the events sent while logged out will go to the user that was previously logged in, not the user that signs in next. For most cases, this behaviour is good enough, so reseting the deviceId is not needed.

However, for cases where you want the events sent while logged out to be merged into the user that signs in next, it seems you do have to reset the deviceId.

 

Problem solved.


Reply