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
languagejs
themeFadeToGrey
personaclick("profile", "set", pcsdk.setProfile(params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Main request parameters

Name

Type

Description

email  

string

User Email.

first_namestringUser First Name.
genderstringUser Gender (m – male, f – female).
idnumber/stringStore side user ID.
last_namestringUser Surname.
phonestringUser Phone.

Additional request parameters

Name

Type

Description

agenumber

User age (in years).

autoObject arrayList of vehicles. See description below.
birthdaystring

User birthday in the format YYYYY-MM-DD.

bought_somethingbooleanThe user has or hasn't ever bought something in the store.
fb_idstringFacebook User ID.
kidsObject arrayUser's children. See description below.
locationstring

The user's current location from the list of locations in the product feed.

loyalty_bonusesnumberThe current number of store bonuses at the user.
loyalty_bonuses_to_next_levelnumberThe 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.

Example of use

Code Block
themeFadeToGrey
personaclick("profile", "set", pcsdk.setProfile({
    id: 100500,
    email: "john.doe@examplemail.com", 
    phone: "4400114527199",
    first_name: "John", 
    last_name: "Doe",
    birthday: "1990-03-11", 
    age: 31,
    gender: "m", 
    location: "NY",
    bought_something: true,
    loyalty_id: "000001234567",
    loyalty_card_location: "NY",
    loyalty_status: "5% discount", 
    loyalty_bonuses: 1123,
    loyalty_bonuses_to_next_level: 1877,
    fb_id: "000000000354677",
    vk_id: "vk031845",
    telegram_id: "0125762968357835",
    kids: [
        {gender: "m", birthday: "2001-04-12"},
        {gender: "f", birthday: "2015-07-28"}
    ],
    auto: [
        {brand: "Nissan", model: "Qashqai", vds: "TM7N243E4G0BJG978"}
    ]
});



Read User Profile

Method Objective

The method returns accumulated (depersonalized) profile data of the current user.

Note

Most of the data is computational based on the user's interaction with the products.

Syntax and parameters

Code Block
languagejs
themeFadeToGrey
personaclick("profile", "get", pcsdk.getProfile().then(callback);

NameTypeRequirementDescription
callbackFunctionrequiredThe callback function that takes the API response. The API response type is an object.

API response

Name

Type

Description

genderstring

The gender of the current user.

childrenObject array

Data about the children of the current user. Each element of the array can contain the following properties:

  • gender (string) - the child's gender
  • birthday (string, YYYY-MM-DD format) - the child's birthday
  • age (number) - the сhild's age
cosmetic_hairobject

The hair properties of the current user:

  • type (string) - Hair Type. Available values: dry, normal, oily, comby.
  • condition (string) - Hair Condition. Available values: colored, damaged, waved, seborea, akne, loss, grow.
cosmetic_skinobject

The skin properties of the current user:

  • body (object) - Body Skin Properties
  • hand (object) - Hands Skin Properties 
  • leg (object) - Legs Skin Properties 

Each of the properties above has the following properties and values:

  • type (string) - Skin Type. Available values: dry, normal, oily, comby.
  • condition (string) - Skin Condition. Available values: dehydrated, sensitive, problem, fading.
cosmetic_perfumeobject

Perfume preferences of the current user. The following properties and values are available:

  • family (array) - Aroma Family. Available values: floral, oriental, woody, fresh.
  • aroma (array) - Subgroup of the Aroma Family. Available values: fruity_floral, floral, soft_floral, floral_oriental, soft_oriental, oriental, woody_oriental, woods, mossy_woods, dry_woods, aromatic, citrus, water, green, fruity.
allergybooleanWhether the current user is allergic.
fashion_sizesobject

Lists clothing types with preferred sizes for each. Available properties: shoe, shirt, tshirt, underwear, trouser, jacket, blazer, sock, belt, hat, glove.

The value of each property is an array with the user's preferred clothing sizes.

compatibilityobject

The preferred brand and model of the vehicle. The following properties are available:

  • brand (string)
  • model (string)
vdsstringThe fourth to ninth position in the VIN is the Vehicle Descriptor Section or VDS.
petsobject

The user's pet. The following properties are available:

  • type (string) - Type of Pet. Available values: dog, cat, bird, fish.
  • breed (string) - Breed of Pet. 
  • size (string) - Size of Pet. Available values: small, medium, large.
  • age (string) - Age of Pet. Available values: young, middle, old.
jewelryobject

The jewelry preferences of the current user. The following properties are available:

  • metal (String array) - Preferred Metal. Available values: gold, silver, platinum.
  • color (String array) - Preferred Color. Available values: white, red, yellow, black.
  • gem (String array) - Preferred Gem. Available values: agate, alexandrite, alpana, amethyst, turquoise, diamond, garnet, garnet_synthetic, pearl, emerald, emerald_geothermal, quartz, quartz_smoky, coral, corundum, corundum_synthetic, malachite, nanocrystal, onyx, nacre, rhodolite, ruby, ruby_synthetic, sapphiresapphire_geothermal, swarovski, sitall, glass, topaz, tourmaline, fianit, chalcedony, chrysolite, chrysoprase, citrine, spinel, spinel_synthetic, amber, mix.
  • gender (String array) - Gender. Available values: "m" or "f".
  • ring_size (Number array) - Preferred ring sizes of the current user.
  • bracelet_size (Number array) - Preferred bracelet sizes of the current user.
  • chain_size (Number array) - Preferred chain sizes of the current user.
realtyobject

Real estate of the current user. The following properties are available:

  • type (string) - Type of Real Estate. Available values: living, office, warehouse, land, shop, manufacturing, cafe, custom.
  • space (number) - The area of the real estate object. 
income_levelstringThe income level of the current user. Available values: cheap, medium, premium.
has_emailbooleanDoes the user's profile contain an email?

Example of use

Code Block
languagejs
themeFadeToGrey
personaclick("profile", "get", function(profile) {
	console.log(profile.gender);
});


Table of Contents
maxLevel2
classpersonaclick-fixed-position