Implementing Login/Logout
- It's important to set the ID when a user logs into your app.
- This merges the new user with the existing user, if any exists, and will help prevent the creation of unnecessary/stale users.
- Setting the ID is a critical piece to tie a user across devices as well across all platforms (i.e. iOS, Android, Web). Call the login method as soon as the user is logged in. ID can be something like an email ID, a username (unique), or a database ID or any Backend generated ID.
- Do not set this for the user who not logged in.
Log In
Moengage.add_unique_user_id(UNIQUE_ID); // UNIQUE_ID is used to uniquely identify a user.
warning |
Warning If you do not use the MoEngage logout method and call |
warning |
Critical - Very Important Integration Guideline Never use both the login methods - |
Log Out
Logs out the current user.
Moengage.destroy_session();
Update User
Moengage.update_unique_user_id(NEW_UNIQUE_ID);
warning |
Critical All the methods mentioned above-
Moengage.add_unique_user_id(UNIQUE_ID).then(() => { |