--- title: "InsiderUser" slug: "webview-insideruser" description: "Use the WebView InsiderUser class to log in/out users, manage identifiers, and set attributes like email, opt-ins, and locale." updated: 2026-10-06T09:04:44Z published: 2026-10-06T09:04:44Z canonical: "academy.insiderone.com/webview-insideruser" --- > ## Documentation Index > Fetch the complete documentation index at: https://academy.insiderone.com/llms.txt > Use this file to discover all available pages before exploring further. # InsiderUser ## Initialize InsiderUser A proxy class for encapsulating user-related operations, such as login, logout, etc. **Method signature** ```typescript getCurrentUser() : InsiderUser ``` **Method example** ```typescript const user = window.insider.getCurrentUser(); ``` ## getInsiderID This method returns the user's Insider ID information. **Method signature** ```typescript getInsiderID() : Promise ``` **Method example** ```typescript const insiderID = await window.insider.getInsiderID(); ``` ## login This method logs the user in with the given identifiers. | Parameter | Type | Description | Required | | --- | --- | --- | --- | | identifiers | InsiderIdentifiers | User identifiers encapsulating email, userID, phone, etc. | Yes | **Method signature** ```typescript login(InsiderIdentifiers identifiers) : Promise ``` **Method example** ```typescript const identifiers = window.insider.createIdentifiers()  .addEmail("john.doe@useinsider.com")  .addPhoneNumber("+1234567890")  .addUserID("454996")  .addCustomIdentifier("locale", "en_US"); const user = window.insider.getCurrentUser(); const insiderID = await user.login(identifiers); ``` ## logout This method logs the user out, clearing their identifiers. **Method signature** ```typescript logout() : Promise ``` **Method example** ```typescript const user = window.insider.getCurrentUser(); await user.logout(); ``` ## logoutResettingInsiderID This method logs the user out, removing the given identifiers tied to them. Calling this method always results in a new Insider ID being generated. | Parameter | Type | Description | Required | | --- | --- | --- | --- | | identifiers | InsiderIdentifiers | User identifiers encapsulating email, userID, phone, etc. | No | **Method signature** ```typescript logoutResettingInsiderID(InsiderIdentifiers identifiers) : Promise ``` **Method example** ```typescript const identifiers = window.insider.createIdentifiers()  .addEmail("john.doe@useinsider.com")  .addPhoneNumber("+1234567890")  .addUserID("454996")  .addCustomIdentifier("locale", "en_US"); const user = window.insider.getCurrentUser(); const newInsiderID = await currentUser.logoutResettingInsiderID([identifiers]); ``` You can also pass an **empty array** or **null** if you do not want any identifiers to be removed from the current user: ```typescript newInsiderID = await currentUser.logoutResettingInsiderID([]); newInsiderID = await currentUser.logoutResettingInsiderID(null); // works same as above ``` ## Set promotional opt-in attribute This method allows you to set the promotional opt-in (permission) attribute for your Insider user object. It stores the user's consent for promotional marketing messages so that it can be used for App Push targeting. > [!WARNING] > If you never call this method, or if you pass the value as *false*, the user is treated as **not opted-in** and will not be targeted by promotional App Push campaigns. This attribute is stored at the user (profile) level, not per device, so its value applies to every device the user is identified on. The method returns a Promise, so it should be awaited to make sure the value has been passed to the native SDK before the session ends. The parameter is validated: passing a **non-boolean** value rejects the call instead of silently storing an invalid attribute. | Parameter | Data Type | | --- | --- | | promotionalOptin | Boolean | **Method signature** ```typescript setPromotionalOptin(promotionalOptin: boolean): Promise<void> ``` **Method example** ```typescript await window.insider.getCurrentUser().setPromotionalOptin(true); ``` ## User attributes You can use the following methods to attach attributes for the user: | Parameter | Type | Required | | --- | --- | --- | | setGender | String | Yes | | setBirthday | Date | Yes | | setName | String | Yes | | setSurname | String | Yes | | setAge | Integer | Yes | | setEmail | String | Yes | | setPhoneNumber | String | Yes | | setLanguage | String | Yes | | setLocale | String | Yes | | setSMSOptin | Boolean | Yes | | setEmailOptin | Boolean | Yes | | setWhatsappOptin | Boolean | Yes | | setPushOptin | Boolean | Yes | | setLocationOptin | Boolean | Yes | | setPromotionalOptin | Boolean | Yes | ### Method example ```typescript const user = window.insider.getCurrentUser(); await user.setGender("female"); await user.setBirthday(new Date("1997-10-08")); await user.setName("Jane"); await user.setSurname("Doe"); await user.setAge(28); await user.setEmail("jane.doe@useinsider.com"); await user.setPhoneNumber("+1234567890"); await user.setLanguage("en"); await user.setLocale("en_US"); await user.setSMSOptin(true); await user.setEmailOptin(true); await user.setWhatsappOptin(false); await user.setPushOptin(true); await user.setLocationOptin(true); ```