Report User Attributes
The SDK can report user attributes after they login.
Report User Attributes
To track the user attributes, when they login, please follow the below format of setting the current user, with the collected attributes.
If you want to track the response of user login process extend PJDSDKLoginDelegate protocol, PJDSDKLoginDelegate contains callback methods for onPJDSDKLoginSuccess and onPJDSDKLoginFailure, implement these methods to your definition.
//Example below doesn’t show all attributes.
let user = PJDSDKModel.User()user.fingerprint = "002ebf12-a125-5ddf-a739-67c3c5d20177"user.firstName = "John"user.lastName = "Doe"user.dob = "1989-12-18"user.gender = "Prefer not to say"user.nationality = "USA"user.meta = ["key01": "val01", "key02": "val02", "key03": "val03"]let address = PJDSDKModel.Address()address.addressLines = ["123 ABC St", "Apt 2201"]address.countryCode = "USA"address.postalCode = "75252"user.address = addressPJDSDK.sharedInstance.delegate = selfPJDSDK.sharedInstance.setCurrentUser(user)
Added mandatory class properties in User in v1.7:
let cookies = PJDSDKModel.Cookies(necessary: true,preferences: true,statistics: true,marketing: true,doNotSell: true)let marketing = PJDSDKModel.Marketing(smsMarketingAllowed: true,emailMarketingAllowed: true,mailMarketingAllowed: true,callMarketingAllowed: true,pushNotificationMarketingAllowed: true,doNotSell: true)let permissions = PJDSDKModel.Permissions(cookies: cookies, marketing: marketing)let user = PJDSDKModel.User(permissions:permissions)
To Update user attributes, call the following method.
PJDSDK.sharedInstance.updateUser(user)
Syntax | Description |
---|---|
PJDSDKModel.User | - |
id | String (Required) |
first_name | String (Required) |
last_name | String (Required) |
fingerprint | String (UDID Required) |
phone | String |
nationality | String |
secondary_nationality | String |
residence | String |
phoneCountryCode | String |
gender | String |
dob | String (yyyy-mm-dd) |
source | String |
sourceID | String |
String | |
address | PJDSDKModel.Address |
meta | String (key/value pairs) |
permissions | PJDSDKModel.Permissions |
membership | PJDSDKModel.Membership |
PJDSDKModel.Address | - |
addressLines | Array of 3 strings at a maximum |
locality | String (city, town, village, etc) |
adminArea | String (administrative area such as state, province, island, etc.) |
subAdminArea | String (county, other governing entity) |
postalCode | String (String postal or zip code (Required) if address is submitted) |
countryCode | String Name or Code for country (ex: Canada or CA) |
latitude | String |
longitude | String |
PJDSDKModel.Membership | - |
isSeasonTicketHolder | boolean |
isSingleGameTicketBuyer | boolean |
isTicketPackageBuyer | boolean |
isClubMember | boolean |
isLoyaltyProgramMember | boolean |
Mandatory Properties
Syntax | Description |
---|---|
PJDSDKModel.Permissions | - |
marketing | PJDSDKModel.Marketing |
cookies | PJDSDKModel.Cookies |
doNotTrack | Bool? (optional, can be nil) |
PJDSDKModel.Marketing | - |
marketingAllowed | Bool |
smsMarketingAllowed | Bool |
emailMarketingAllowed | Bool |
mailMarketingAllowed | Bool |
callMarketingAllowed | Bool |
pushNotificationMarketingAllowed | Bool |
PJDSDKModel.Cookies | - |
necessary | Bool |
preferences | Bool |
statistics | Bool |
marketing | Bool |
doNotSell | Bool |
custom | [String:Bool]? (optional, can be nil) |
NOTE :
Last three tables above contain the mandatory properties (mandatory requirement enforced from the v1.7)
If you want to track the response of user login process extend PJDSDKLoginDelegate protocol, PJDSDKLoginDelegate contains callback methods for onPJDSDKLoginSuccess and onPJDSDKLoginFailure, implement these methods to your definition.
Assign your viewcontroller instance to the delegate before your setCurrentUser(:) method like this PJDSDK.sharedInstance.delegate = self