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
You get an instance of WebEngage
WEGUser object as follows:
WEGUser* weUser = [WebEngage sharedInstance].user;
Use following API to identify a user to WebEngage:
When a user Logs-In (
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
loggedInAPI call), all of this stored information is attributed to this
When a user Logs-Out (
When a user logs out of your application then
Call this when the
logged-inuser logs-out, or, you do not want to attach any future event, session and/or user data with this user, unless
loggedInis called again.
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;
BOOLtype values use, [NSNumber numberWithBool: (BOOL) boolValue];
-(void) setEmail:(NSString*)email; -(void) setBirthDate:(NSDate*) dob; -(void) setGender:(NSString*)gender; -(void) setFirstName:(NSString*)name; -(void) setLastName:(NSString*)name; -(void) setCompany:(NSString*)company;
Use following API on
WEGUser object to set opt_in status of a user for a particular
-(void) setOptInStatusForChannel:(WEGEngagementChannel)channel status:(BOOL) statusValue;
WEGEngagementChannelis 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.
-(void) deleteAttribute:(NSString*)attributeName; -(void) deleteAttributes:(NSArray<NSString*>*)attributes;
WEGUserProfileAttributeis 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