Versions Compared

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 anonymous@example.com, or an automatically generated email address that doesn't have anything to do with the user's actual email.

Syntax and parameters

Code Block
languagejavaapplescript
themeFadeToGrey
PersonaClick sdk.profilesetProfileData(params); { callback }

NameTypeRequirementDescription
paramsHashMaprequiredObject with request parameters.
Main request parameters
callbackfunctionoptionallyCallback Function

Request Parameters

Name

Type

Description

age

Name

Type

Description

email  userEmail

string

User Email.

first_namefirstNamestringUser First Name.
genderstringUser Gender (m – male, f – female).
iduserLoyaltyIdstringStore side The Loyalty Program user ID (loyalty card).
last_namelastNamestringUser Surname.
phoneuserPhonestringUser Phone.

Additional request parameters

userIdstring

User age (in years).

autoJSON stringList of vehicles. See description below.
Store side user ID
birthdaystringUser birthday in the format YYYYY-MM-DD.
bought_somethingfb_idstringFacebook User ID.kidsJSON stringUser's children. See description below
agestring
The user has or hasn't ever bought something in the store. "1" - if the user has made purchases, "0" - if not.
User age (in years).
locationstringThe user's current location from the list of locations in the product feed.
loyalty_bonuses
customPropertiesDictionary [string
The current number of store bonuses at the user.loyalty_bonuses_to_next_levelstringThe number of store bonuses necessary for the user to reach the next loyalty level.loyalty_card_locationstringThe location (from the list of locations in the product feed) where the user last used the loyalty card.loyalty_idstringThe Loyalty Program user ID (loyalty card).loyalty_statusstringThe user's current status in the loyalty program.telegram_idstringTelegram User ID.vk_idstringVKontakte User ID.

The "auto" object properties

Name

Type

Description

brandstring

Vehicle Brand.

modelstringVehicle Model.vdsstring

Vehicle's VDS/VIN.

The "kids" object properties

Name

Type

Description

genderstringChild's age (m – male, f – female).birthdaystringChild's birthday in the format YYYY-MM-DD
: Any]

Dictionary of custom properties. The custom property must be created before it can be used. Located there: Account > Settings > Profile Property

Tip

If property creation isn't available in the account, contact PersonaClick support.


Example of use

Code Block
languagejavaapplescript
themeFadeToGrey
HashMap<String,# String>custom paramsproperties
=let new HashMap<>();
params.put("idstringArray = ["item1", "100500item2");
params.put("email", "john.doe@examplemail.com");
params.put("phone", "4400114527199");
params.put("first_name", "John");
params.put("last_name", "Doe");
params.put("birthday", "1990-03-11");
params.put("age", "31");
params.put("gender", "m");
params.put("location", "NY");
params.put("bought_something", "1");
params.put("loyalty_id", "000001234567");
params.put("loyalty_card_location", "NY");
params.put("loyalty_status", "5% discount");
params.put("loyalty_bonuses", "1123");
params.put("loyalty_bonuses_to_next_level", "1877");
params.put("fb_id" ,"000000000354677");
params.put("vk_id", "vk031845");
params.put("telegram_id", "0125762968357835");
params.put("kids", "[{\"gender\":\"m\",\"birthday\":\"2001-04-12\"},{\"gender\": \"f\", \"birthday\": \"2015-07-28\"}]");
params.put("auto", "[{\"brand\":\"Nissan\",\"model\":\"Qashqai\",\"vds\":\"TM7N243E4G0BJG978\"}]");
PersonaClick.profile(params);
Table of ContentsmaxLevel2classpersonaclick-fixed-position
, "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",
    "integer_prop": 123,
    "float_prop": 7.62,
    "date_prop": "2021-12-31 23:55:00",
    "stringArray": stringArray,
    "intArray": intArray,
    "floatArray": floatArray,
    "boolArray": boolArray,
    "dateArray": dateArray,
    "customObject": object
]

sdk.setProfileData(
    userEmail: "john.doe@examplemail.com",
    userPhone: "4400114527199",
    userLoyaltyId: "000001234567",
    birthday: "1990-03-11",
    age: "31",
    firstName: "John",
    lastName: "Doe",
    userId: "extID100500",
    location: "NY",
    gender: "m",
    customProperties: customProperties
) { (profileDataResp) in
      print("Profile data callback")
}


Anchor
did
did
Get Device ID of Current Profile

Method Objective

The method allows getting the Device ID of the current profile.

Syntax

Code Block
languageapplescript
themeFadeToGrey
 sdk.getDeviceID()

Example of use

Code Block
languageapplescript
themeFadeToGrey
var deviceId = sdk.getDeviceID()



Column

Page Navigation

Table of Contents
maxLevel2
indent0px
stylenone




Related Pages

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
cqllabel = "profile"