Versions Compared
Version | Old Version 13 | New Version Current |
---|---|---|
Changes made by | ||
Saved on |
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Update User Profile
Method Objective
The method updates the user's profile or creates a new profile bound to the user's current device if it was not created earlier.
Note |
---|
If you don't have user data, never send bogus data. It'll cause problems in profile handling in the future. For example, don't send a non-existent email, like |
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.setProfileData(params) { callback } |
Name |
---|
Requirement | Description |
---|---|
params |
required | Object with request parameters. | |
callback |
optionally | Callback Function |
Request Parameters
Name |
---|
Description | |
---|---|
userEmail |
User Email. | |
firstName |
User First Name. | |
gender |
User Gender (m – male, f – female). | |
userLoyaltyId |
The Loyalty Program user ID (loyalty card). | |
lastName |
User Surname. |
userPhone |
User Phone. | |
userId |
Store side user ID | |
birthday |
User birthday in the format YYYYY-MM-DD. | |
age |
User age (in years). |
location |
The user's current location from the list of locations in the product feed. | |
customProperties |
Dictionary of custom properties. The custom property must be created before it can be used. Located there: Account > Settings > Profile Property
|
Non-scalar data types are not supported in the current version of the SDK.
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.setProfileData( userEmail: "john.doe@examplemail.com", userPhone: "4400114527199", userLoyaltyId: "000001234567", birthday: "1990-03-11", age: "31# custom properties let stringArray = ["item1", "item2", "item3"] let intArray = [1, 2, 3, 4, 5] let floatArray: [Float] = [1.1, 2.2, 3.3] let boolArray = [true, false, true] let dateArray = [Date(),Date(),Date()] let object: [String: Any] = [ "stringKey": "stringValue", "intKey": 123, "floatKey": 45.67, "boolKey": true, "dateKey": Date(), "arrayKey": [1, 2, 3], "nestedObjectKey": [ "nestedStringKey": "nestedValue", "nestedIntKey": 456 ] ] let customProperties: [String: Any] = [ "string_prop": "string_value", firstName: "John""integer_prop": 123, "float_prop": 7.62, lastName"date_prop": "Doe2021-12-31 23:55:00", userId:"stringArray": stringArray, "extID100500intArray": intArray, location:"floatArray": floatArray, "NYboolArray": boolArray, gender"dateArray": "m",dateArray, "customObject": object ] sdk.setProfileData( customProperties: [userEmail: "john.doe@examplemail.com", userPhone: "4400114527199", userLoyaltyId: "property1"000001234567", birthday: "value11990-03-11", age: "31", firstName: "property2"John", lastName: "value2Doe", userId: "extID100500", location: "property3"NY", gender: "value3m", ]customProperties: customProperties ) { (profileDataResp) in print("Profile data callback") } |
Anchor | ||||
---|---|---|---|---|
|
Method Objective
The method allows getting the Device ID of the current profile.
Syntax
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.getDeviceID() |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
var deviceId = sdk.getDeviceID() |
Column | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Page Navigation
Related Pages
|