Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

WebEngage allows you to attach attributes to logged-in as well as anonymous users.

Attributes are a set of properties that make up a user profile. This profile information can be used to segment users which allows for better targeting based on different user personas.

All User related API's are part of WebEngage Android SDK's User Object.

You get an instance of WebEngage User object as follows:

// import WebEngage 'User'
import com.webengage.sdk.android.User;

// Get an instance of `User` object
User weUser = WebEngage.get().user();

User Identification

Use following API to identify a user to WebEngage:

When a user Logs-In (Identifying User)

weUser.login(String identifer)

IMP: Please make sure to call above api as soon as a user logs into your application, or whenever earliest you are able to identify him/her.

Once called, every session, user attribute and event will be attributed to this user.

All attributes, events and session information accumulated before this API has been called gets associated to an anonymous user created by default. Once this anonymous user is identified (by using login() API call), all of this stored information is attributed to this logged-In (identified) user.

When a user Logs-Out (Forgetting User)

When a user logs out of your application then

weUser.logout()

Call this when the logged-in user logs-out, or, you do not want to attach any future event, session and/or user data with this user, unless login is called again.

Setting Custom User Attributes

Use these API's to attach custom attributes to the user

weUser.setAttribute(String attributeName,String value)

weUser.setAttribute(String attributeName,Boolean value)

weUser.setAttribute(String attributeName,Long value)

weUser.setAttribute(String attributeName,Double value)

weUser.setAttribute(String attributeName,Integer value)

weUser.setAttribute(String attributeName,Date value)

weUser.setAttribute(String attributeName,List<? extends Object> values)

Data Types

Following are the data types which are allowed for event attributes. Attribute having any other data type would be rejected by SDK.

  • String
  • Integer
  • Long
  • Double
  • Boolean
  • Date
  • List
  • Map

None of the attributeNames should start with we_, else they'll be ignored. Attribute names starting with we_ are reserved for WebEngage's internal uses.

weUser.setAttributes(Map<String,? extends Object> attributes)


Setting Pre-Defined User Attributes

weUser.setEmail(String email)
 
weUser.setHashedEmail(String hashedEmail)

weUser.setBirthDate(Integer year,Integer month,Integer day) // Month is index 1 based: January = 1,
  
weUser.setBirthDate(String birthDate) //yyyy-MM-dd
  
weUser.setPhoneNumber(String phoneNumber)
  
weUser.setHashedPhoneNumber(String hashedPhoneNumber)

weUser.setGender(Gender gender)

weUser.setFirstName(String firstName)

weUser.setLastName(String lastName)

weUser.setCompany(String company)

weUser.setUserProfile(UserProfile userProfile) // Use this to set user profile in one go using `Java Builder Pattern`

The upper bound on attribute name and its value(in case of String) is 50 and 1000 chars respectively.Anything beyond that will be truncated.

Deleting Custom User Attributes

weUser.deleteAttribute(String attributeKey)

weUser.deleteAttributes(List<String> attributeKeys)

Managing Engagement Channels Opt-In Status.

This API sets the user's opt in preference to a particular channel. Channel could be PUSH, IN_APP, SMS or EMAIL .

weUser.setOptIn(Channel channel, boolean state);

Channel is an enum which have following values:

  • PUSH
  • IN_APP
  • SMS
  • EMAIL

Once a user is opted out of a particular channel, he/she will not receive any message on that channel. Default value is true.

User