Prerequisites
Tracking needs to be enabled during SDK initialization for this feature to work.
Set CastledConfigs.enableTracking to true to start tracking.
Castled SDK provides methods that lets you create or update user profiles within your data warehouse.
ThUser profile attributes can be one of the predefined attributes or any custom attribute of your choosing.Following are the list of predefined user attributes avaliable for use when updating user profiles
First Name
Last Name
Email
Name
Date of Birth
Gender
Phone Number
City
Country
Custom attribute values can be of type number, boolean, string or date.
Please find below a sample code snippet to create/update user profile:
Copy
let userAttributes = CastledUserAttributes()userAttributes.setFirstName("John")userAttributes.setLastName("Doe")userAttributes.setCity("Sanfrancisco")userAttributes.setCountry("US")userAttributes.setEmail("doe@email.com")userAttributes.setDOB("02-01-1995")userAttributes.setGender("M")userAttributes.setPhone("+13156227533")// Custom AttributesuserAttributes.setCustomAttribute("prime_member", true)userAttributes.setCustomAttribute("occupation", "artist")Castled.sharedInstance.setUserAttributes(userAttributes)
Before updating user attributes make sure the user-id has been set using
setUserId.