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 iOS SDK's WEGUser object.

You get an instance of WebEngage WEGUser object as follows:

WEGUser* weUser = [WebEngage sharedInstance].user;

User Identification

Use following API to identify a user to WebEngage:

When a user Logs-In (Identifying User)

//(Available >= 3.4.12)
-(void) login:(NSString*)userIdentifier;

//(deprecated >= 3.4.12, use login instead)
-(void) loggedIn: (NSString*)userIdentifier;

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 attributes to an anonymous user created by default. Once this anonymous user is identified (by using loggedIn API call), all of this stored information is attributed to this loggedIn (identified) user.

When a user Logs-Out (Forgetting User)
When a user logs out of your application then

//(Available >= 3.4.12)
-(void) logout;

//(deprecated `loggedOut` as of 3.4.12)
-(void) loggedOut;

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 loggedIn is called again.

Setting Custom User Attributes

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

-(void) setAttribute:(NSString*)attributeName withStringValue:(NSString*)value;
-(void) setAttribute:(NSString*)attributeName withValue:(NSNumber*)value;
-(void) setAttribute:(NSString*)attributeName withArrayValue:(NSArray*)value;
-(void) setAttribute:(NSString*)attributeName withDateValue:(NSDate*)value;

//(Available >=3.4.14)
-(void) setAttribute:(NSString*)attributeName withDictionaryValue:(NSDictionary*)value; 

For BOOL type values use, [NSNumber numberWithBool: (BOOL) boolValue];

Setting Pre-Defined User Attributes

-(void) setEmail:(NSString*)email;
-(void) setGender:(NSString*)gender;
-(void) setFirstName:(NSString*)name;
-(void) setLastName:(NSString*)name;
-(void) setCompany:(NSString*)company;

//(Format: yyyy-MM-dd, Available >=3.4.14)
-(void) setBirthDateString:(NSString*) dobString;

//(Deprecated >=3.4.14, use setBirthDateString instead)
-(void) setBirthDate:(NSDate*) dob; 

//(Available >= 3.4.2)
-(void) setHashedEmail:(NSString*)hashedEmail; 
-(void) setHashedPhone:(NSString*)hashedPhone; 

Managing Users' opt_In Status

Use following API on WEGUser object to set opt_in status of a user for a particular channel

-(void) setOptInStatusForChannel:(WEGEngagementChannel)channel status:(BOOL) statusValue;

WEGEngagementChannel is an enum with the following options:

  WEGEngagementChannelPush // For Push Notifications
  WEGEngagementChannelInApp // For In-App Messages

You can use this API to set users' opt_in preference to a Channel. Channel could be Push Notifications, IN-APP Notifications, IN-APP Surveys (coming soon) , SMS (coming soon), etc..
Once a user opts-out of a channel, he/she will not receive any message on that channel.

This is also reflected in your dashboard where you can see how many users have opted-out (from a particular channel), and can be used to target accordingly.

Default value: YES

Deleting Custom User Attributes

-(void) deleteAttribute:(NSString*)attributeName;
-(void) deleteAttributes:(NSArray<NSString*>*)attributes;

Deleting System User Attributes

-(void) deleteAttributeType:(WEGUserProfileAttribute)attributeName;

WEGUserProfileAttribute is an enum with the following options:

  WEGUserProfileAttributeEmail // User's email
  WEGUserProfileAttributeBirthDate // User's date of birth
  WEGUserProfileAttributeGender // User's gender
  WEGUserProfileAttributeFirstName // User's first name
  WEGUserProfileAttributeLastName // User's last name
  WEGUserProfileAttributeCompany // User's organisation


Learn how to integrate WebEngage with Swift application. For a general understanding on how to use objective C APIs in Swift Code, visit here.