Skip to main content

Hello! I need to reset the Amplitude session, device ID, and user ID when a user logs out. I'm essentially looking for a way to perform an amplitude.reset() operation on the backend (in Ruby). Is this possible?

Hello Cathy,

Thanks for writing to Support. Happy to help!

The `amplitude.reset()` function is available in the Amplitude SDKs and is typically used on the client-side (like in a browser or mobile app) to clear user data when a user logs out. This function sets the `userId` to `null` and generates a new `deviceId.`

However, for a server-side implementation like in Ruby, the concept of resetting a session doesn't exactly apply in the same way. On the server-side, you typically send events to Amplitude with a `userId` and/or `deviceId` that you manage. When a user logs out, you would stop associating events with that user's `userId` and/or `deviceId`.

If you want to mimic the behavior of `amplitude.reset()`, you could generate a new `deviceId` for the user after they log out and stop associating events with their old `userId`. However, please note that this is not a built-in function of the server-side SDKs and would need to be managed in your application logic.

I hope this helps! Let me know if you have any other questions.


Best,

Jacenda


P.S. Checkout upcoming events and user meetups on our events page.

Reply