User Profile

In addition to user activity tracking, you can report and store user profile attributes with Vessel.

1. Create User Profile

You can create rich profiles by sending profile details with custom attributes as shown bellow.

//You can create and set user attributes as shown bellow.

 VesselUserAttributes *attributes = [[VesselUserAttributes alloc] init];
 [attributes setName:@"Mark Zuckerberg"];
 [attributes setId:@"10237849"];
 [attributes setEmail:@"[email protected]"];
 [attributes setGender:@"male"];
 [attributes setFacebookId:@"facebookid"];
 [attributes setInstallSource:@"_facebook_ads"];
//You can create and set user attributes as shown bellow.
    
VesselUserAttributes userAttributes = new VesselUserAttributes();
userAttributes.setGivenId("10237849");
userAttributes.setName("Michael Pollack");
userAttributes.setEmail("[email protected]");
userAttributes.setGender("male");
userAttributes.setInstallSource("_facebook_ads");
vesselSDK.setUserAttributes({'name': 'TestName',
'gender': 'male',
'address': '50E 3rd St',
'country': 'USA',
'state': 'CA',
'zipcode': '94041',
'twitter_id': '123',
'facebook_id': '63474041',
'linkedin_id': '1139749874',
'paid_user': 'true',
'install_source': 'facebook_ad',
'city': 'Mountain View',
'email': '[email protected]',
});

2. Add Custom Attributes

You can create an unlimited number of custom attributes using following method:

//Create a dictionary with your custom attributes

NSDictionary *customAttributes = @{@"plan":@"free",
                                       @"trialDays":@(30),
                                       @"unitValue":@(100)
                                       };

// Set them as custom attributes 
[attributes setCustomAttributes:customAttributes];
// Create a json object with your custom attributes

JSONObject customAttributes = new JSONObject();
customAttributes.put("adUnit", "google");
customAttributes.put("plan", "premium");
customAttributes.put("trial_days", 25);

// Set them as custom attributes          
userAttributes.setCustomAttributes(customAttributes);
vesselsdk.setUserAttributes({
'custom':{'adUnit':'adMob', 'plan':'premium'},
});

3. Report User Profile

Once you've successfully created and update user attributes you can report them back to Vessel.

// This method will set user attributes and/or updates user profile. 

Vessel *sharedInstance = [Vessel sharedInstance];
[sharedInstance setUserAttributes:attributes];
// This method will set user attributes and/or updates user profile

VesselSDK sharedInstance = VesselSDK.getInstance(context);
sharedInstance.setUserAttributes(userAttributes)