User Attributes enable you to share information with WalkMe about your app's end-users, such as their role, preferences, subscription and other characteristics.
Configuring User Attributes Via API
iOS
/**
* Sets a user attribute
*
* @param key the attribute key
* @param value the attribute value
*
* @code
* Usage Examples:
* [ABBI setUserAttributeWithKey:@"isProUser" andValue:@YES];
* [ABBI setUserAttributeWithKey:@"isLoggedIn" andValue:@(0)];
*//
+(void)setUserAttributeWithKey:(NSString *)key andValue:(id)value;
/**
* Sets multiple user attributes
*
* @param attributes the user attributes
*
* @code
* Usage Example:
* [ABBI setUserAttributes:@{@"isProUser": @YES, @"isLoggedIn": @(0)}];
*/
+(void)setUserAttributes:(NSDictionary<NSString*,id> *)attributes;
/**
* Sets a private user attribute
*
* @param key the attribute key
* @param value the attribute value
*
* @code
* Usage Examples:
* [ABBI setPrivateUserAttributeWithKey:@"gender" andValue:@"female"];
* [ABBI setPrivateUserAttributeWithKey:@"balance" andValue:@(1000)];
*/
+ (void)setPrivateUserAttributeWithKey:(NSString *)key andValue:(id)value;
/**
* Sets multiple private user attributes
*
* @param attributes the private user attributes
*
* @code
* Usage Example:
* [ABBI setPrivateUserAttributes:@{@"gender": @"female", @"balance": @(1000)}];
*/
+ (void)setPrivateUserAttributes:(NSDictionary<NSString*,id> *)attributes;
/**
* Clears all private user attributes
*/
+ (void)clearPrivateUserAttributes;
Android
/**
* Sets a user attribute
*
* @param key the attribute key
* @param value the attribute value (only primitive types are supported)
*
* <p>
* <b><u>Usage Examples:</u></b>
* </p>
* {@code
* ABBI.setUserAttribute("isProUser", true);
* ABBI.setUserAttribute("isLoggedIn", false);
* }
*/
public static void setUserAttribute(String key, Object value)
/**
* Sets multiple user attributes
*
* @param attributes the user attributes
*
* <p>
* <b><u>Usage Example:</u></b>
* </p>
* {@code
* ABBI.setUserAttributes(new HashMap (String, String)(){{ put("isProUser", true); put("isLoggedIn", false); }};)
* }
*/
public static void setUserAttributes(Map<String,Object> attributes)
/**
* Sets a private user attribute
*
* @param key the attribute key
* @param value the attribute value (only primitive types are supported)
*
* <p>
* <b><u>Usage Examples:</u></b>
* </p>
* {@code
* ABBI.setPrivateUserAttribute("gender", "female");
* ABBI.setPrivateUserAttribute("balance", 1000);
* }
*/
public static void setPrivateUserAttribute(String key, Object value)
/**
* Sets multiple private user attributes
*
* @param attributes the private user attributes
*
* <p>
* <b><u>Usage Example:</u></b>
* </p>
* {@code
* ABBI.setPrivateUserAttributes(new HashMap (String, String)(){{ put("gender", "female"); put("balance", 1000); }};)
* }
*/
public static void setPrivateUserAttributes(Map<String,Object> attributes)
/**
* Clears all private user attributes
*/
public static void clearPrivateUserAttributes()
React Native
import WalkMeSDK from 'react-native-walkme-sdk';
//...
// Platform iOS //
// Setting single user attribute
WalkMeSDK.setUserAttribute("key", "value") // Single value
// Setting multiple user attributes
WalkMeSDK.setUserAttributes({"key1": 3, "key2": "yes", "key3": false})
// Setting single Private user attribute
WalkMeSDK.setPrivateUserAttribute("privateKey1", 3)
// Setting multiple Private user attributes
WalkMeSDK.setPrivateUserAttributes({"privateKey1": 3, "privateKey2": "private value", "privateKey3": false})
// Clear Private user attributes
WalkMeSDK.clearPrivateUserAttributes()
// Platform Android //
// Setting single user attribute
WalkMeSDK.setUserAttributes({"key1": 3})
// Setting multiple user attributes
WalkMeSDK.setUserAttributes({"key1": 3, "key2": "yes", "key3": false})
// Setting single Private user attribute
WalkMeSDK.setUserAttributes({"privateKey1": 3})
// Setting multiple Private user attributes
WalkMeSDK.setUserAttributes({"privateKey1": 3, "privateKey2": "yes", "privateKey3": false})
// Clear Private user attributes
WalkMeSDK.clearPrivateUserAttributes()
Cordova
document.addEventListener("deviceready", function() {
// ...
let walkme = window.cordova.plugins['WalkMeSDK'];
// Setting single user attribute
walkme.setUserAttribute("key1", 3);
// Setting multiple user attributes
walkme.setUserAttributes({"key1": 3, "key2": "yes", "key3": false});
// Setting single Private user attribute
walkme.setPrivateUserAttribute("privateKey1", "someValue");
// Setting multiple private user attributes
walkme.setPrivateUserAttributes({"privateKey1": 3, "privateKey2": "yes", "privateKey3": false});
}, false);