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 |
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
pcsdk.setProfile(params); |
Name | Type | Requirement | Description |
---|---|---|---|
params | Object | required | Object with request parameters. |
Main request parameters
Name | Type | Description |
---|---|---|
string | User Email. | |
first_name | string | User First Name. |
gender | string | User Gender (m – male, f – female). |
id | number/string | Store side user ID. |
last_name | string | User Surname. |
phone | string | User Phone. |
Additional request parameters
Name | Type | Description |
---|---|---|
age | number | User age (in years). |
auto | Object array | List of vehicles. See description below. |
birthday | string | User birthday in the format YYYYY-MM-DD. |
bought_something | boolean | The user has or hasn't ever bought something in the store. |
fb_id | string | Facebook User ID. |
kids | Object array | User's children. See description below. |
location | string | The user's current location from the list of locations in the product feed. |
loyalty_bonuses | number | The current number of store bonuses at the user. |
loyalty_bonuses_to_next_level | number | The number of store bonuses necessary for the user to reach the next loyalty level. |
loyalty_card_location | string | The location (from the list of locations in the product feed) where the user last used the loyalty card. |
loyalty_id | string | The Loyalty Program user ID (loyalty card). |
loyalty_status | string | The user's current status in the loyalty program. |
telegram_id | string | Telegram User ID. |
vk_id | string | VKontakte User ID. |
The "auto" object properties
Name | Type | Description |
---|---|---|
brand | string | Vehicle Brand. |
model | string | Vehicle Model. |
vds | string | Vehicle's VDS/VIN. |
The "kids" object properties
Name | Type | Description |
---|---|---|
gender | string | Child's age (m – male, f – female). |
birthday | string | Child's birthday in the format YYYY-MM-DD. |
Custom Properties
Name | Type | Description | ||
---|---|---|---|---|
A custom property can have any name except the reserved ones | string | The custom property must be created before it can be used. Located there: Account > Settings > Profile Property
| ||
integer | ||||
float | ||||
array of string | ||||
json | ||||
date |
Example of use
Code Block | ||
---|---|---|
| ||
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"}
],
custom_string_property: "the string value of the custom property",
custom_integer_property: 100500,
custom_float_property: 7.62,
custom_array_of_string_property: ["value1", "value2", "value3"],
custom_json_property: {key1: value1, key2: value2, key3: value3},
custom_date_property: "2021-12-31 23:55:00"
}); |
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 | ||||
---|---|---|---|---|
| ||||
pcsdk.getProfile().then(callback); |
Name | Type | Requirement | Description |
---|---|---|---|
callback | Function | required | The callback function that takes the API response. The API response type is an object. |
API response
Name | Type | Description |
---|---|---|
gender | string | The gender of the current user. |
children | Object array | Data about the children of the current user. Each element of the array can contain the following properties:
|
cosmetic_hair | object | The hair properties of the current user:
|
cosmetic_skin | object | The skin properties of the current user:
Each of the properties above has the following properties and values:
|
cosmetic_perfume | object | Perfume preferences of the current user. The following properties and values are available:
|
allergy | boolean | Whether the current user is allergic. |
fashion_sizes | object | Lists clothing types with preferred sizes for each. See available type values in the Apparel & Accessories section. The value of each property is an array with the user's preferred clothing sizes. |
compatibility | object | The preferred brand and model of the vehicle. The following properties are available:
|
vds | string | The fourth to ninth position in the VIN is the Vehicle Descriptor Section or VDS. |
pets | object | The user's pet. The following properties are available:
|
jewelry | object | The jewelry preferences of the current user. The following properties are available:
|
realty | object | Real estate of the current user. The following properties are available:
|
income_level | string | The income level of the current user. Available values: cheap, medium, premium. |
has_email | boolean | Does the user's profile contain an email? |
custom_properties | Object | The object contains the values of the custom properties that were marked as available for the public part (frontend). The custom properties are located there: Account > Settings > Profile property |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
pcsdk.getProfile().then(function(profile) { console.log(profile.gender); }); |
Set Push Notification Token
Method Objective
The method allows sending to the system the actual token for push notifications.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
pcsdk.setPushTokenNotification(token); |
Name | Type | Requirement | Description |
---|---|---|---|
token | string | required | The current token to be saved |
Example of use
Code Block | ||
---|---|---|
| ||
pcsdk.setPushTokenNotification("fG8mMaBAEKjCDKzGSHMOjq:APA69xfN9IMgX1bGgBV_rNpLElp_9ZlHnOvxp4WwWT5trhbKdBfH9aiM_ntLA-hvoUblhGCFgwiqUKyJ7JhJmaNGD2tx0vBgNOCexpYQ-m1JhQr42YLeKLwPI9yHtNE2B"); |
Column | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Page Navigation
Related Pages
|