Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

Product View

Method Objective

REQUIRED The method gives the system an understanding of the product viewed by the user.

Syntax and parameters

pcsdk.track("view", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe ID of the current product.
stockbooleanoptionallyAvailability of the current product for purchase.
recommended_bystringrequired in some cases

If used, the value must be one of:

  • "dynamic" - if the product is viewed from the recommendation block
  • "instant_search" - if the product is viewed from the Instant Search widget
  • "fill_search" - if the product is viewed from the search results page

See examples below.

recommended_codestringrequired in some cases

If used, the value must be one of:

  • unique code of recommendation block, if "recommended_by" value is "dynamic". The code is available in the PersonaClick account in the "data-recommender-code" attribute of each block.
  • search query string if "recommended_by" value is "instant_search" or "full_search"

See examples below.

Examples of use

pcsdk.track("view", {
	id: "100500",
	stock: true,
	recommended_by: "dynamic",
    recommended_code: "c6d2fe5fdca0c8e51d10b07523bc07"
});

pcsdk.track("view", {
	id: "146",
	stock: false,
	recommended_by: "instant_search",
    recommended_code: "mobile pho"
});

pcsdk.track("view", {
	id: "100500",
	stock: true,
	recommended_by: "full_search",
    recommended_code: "mobile phone 5G"
});



Category View

Method Objective

REQUIRED The method gives the system an understanding of the category viewed by the user.

The API will respond with an error for categories unknown to the system. The system only knows the categories from the product feed (XML) or the HTTP import of the category list.

Syntax and parameters

pcsdk.track("category", id);

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe ID of the current category.

Example of use

pcsdk.track("category", "146");



Adding a product to the cart

Method Objective

REQUIRED The method gives the system an understanding of the product added to the cart by the user.

Syntax and parameters

pcsdk.track("cart", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe ID of the product added to the cart.
amountnumberoptionallyQuantity of product. Default: 1.
stockbooleanoptionallyAvailability of the current product for purchase.
recommended_bystringrequired in some cases

If used, the value must be one of:

  • "dynamic" - if the product is added to the cart from the recommendation block
  • "instant_search" - if the product is added to the cart from the Instant Search widget
  • "fill_search" - if the product is added to the cart from the search results page

See examples below.

recommended_codestringrequired in some cases

If used, the value must be one of:

  • unique code of recommendation block, if "recommended_by" value is "dynamic". The code is available in the PersonaClick account in the "data-recommender-code" attribute of each block.
  • search query string if "recommended_by" value is "instant_search" or "full_search"

See examples below.

Examples of use

pcsdk.track("cart", {
    id: "100500",
    amount: 3,
    stock: true,
    recommended_by: "dynamic",
    recommended_code: "c6d2fe5fdca0c8e51d10b07523bc07"
});

pcsdk.track("cart", {
    id: "100500",
    amount: 3,
    stock: true,
	recommended_by: "instant_search",
    recommended_code: "mobile pho"
});

pcsdk.track("cart", {
    id: "100500",
    amount: 3,
    stock: true,
	recommended_by: "full_search",
    recommended_code: "mobile phone 5G"
});



Removing a product from the cart

Method Objective

REQUIRED The method gives the system an understanding of the product removed from the cart by the user.

Syntax and parameters

pcsdk.track("remove_from_cart", id);

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe ID of the product removed from the cart.

Example of use

pcsdk.track("remove_from_cart", "100500");



Update the current cart

Method Objective

The method updates the whole cart on the system side.

Use this method when the user, for example, changes the quantity of a product in the cart or completely purges the cart. Also, this method can be used as an alternative to the "Add to cart" and "Remove from cart" methods if you have access to the entire cart when these events occur for a specific product.

Syntax and parameters

pcsdk.track("cart", params);

NameTypeRequirementDescription
paramsObject arrayrequiredObject array with request parameters.

Request parameters

Each object in the array can contain the following properties.

NameTypeRequirementDescription
idnumber/stringrequiredThe ID of the product in the cart.
amountnumberoptionallyQuantity of the product.

Example of use

pcsdk.track("cart", [
    {
        id: "100500",
        amount: 3
    },
    {
        id: "146",
        amount: 1
    }
]);


Successful checkout

Method Objective

REQUIRED The method gives the system information about the successful checkout, its products, and other information related to the checkout.

Syntax and parameters

pcsdk.track("purchase", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
productsarrayrequiredAn array of purchased products. See the table below for details.
ordernumber/stringoptionallyInternal store Order ID. If not specified, the system will create its internal ID. Synchronization of order statuses, in this case, won't be available.
order_pricenumberoptionallyThe final order value, including all discounts. If not specified, the system will calculate the order value based on prices from the product feed.
order_cashnumberoptionallyThe amount of money the user spent to pay for the order.
order_bonusesnumberoptionallyThe number of bonuses the user spent to pay for the order.
order_deliverynumberoptionallyShipping cost.
order_discountnumberoptionallyDiscount amount.
promocodestringoptionallyPromo code that was used.
delivery_typestringoptionallyShipping method. Available values:
  • self_pickup
  • delivery
  • pickup_point
payment_typestringoptionallyPayment method. Any string value. For example: "cash", "card", "wire".


Product properties:

NameTypeRequirementDiscription
idnumber/stringrequiredProduct ID.
amountnumberrequiredProduct Quantity.
pricenumberoptionally

The unit price of the product. If not specified, the system will use the price from the product feed. 

stockbooleanoptionallyProduct availability.
customobjectoptionallyThis parameter can only contain the "fashion_size" property with a string or numeric value of the clothing size. See example below.


pcsdk.track("purchase", {
    products: [
        {id: "37", price: 100, amount: 3, stock: true},
        {id: "187", price: 500, amount: 1, stock: false, custom: { fashion_size: "XL" }}
    ],
    order: "N100500",
    order_price: 750,
    order_cash: 650,
    order_bonuses: 100,
    order_delivery: 0,
    order_discount: 50,
    promocode: "BIRTHDAY",
    delivery_type: "delivery",
    payment_type: "cart"
});



Search Request

Method Objective

The method gives the system an understanding of the user's search queries.

Syntax and parameters

pcsdk.track("search", search_query);

Request parameters

NameTypeRequirementDescription
search_querystringrequiredSearch query phrase.

Example of use

pcsdk.track("search", "to be or not to be");



Adding a product to the wishlist

Method Objective

The method gives the system an understanding the user has added a product to the wishlist.

Syntax and parameters

pcsdk.track("wish", id);

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe ID of the product added to the wishlist.

Example of use

pcsdk.track("wish", "100500");



Removing a product from the wishlist

Method Objective

The method gives the system an understanding the user has removed a product from the wishlist.

Syntax and parameters

pcsdk.track("remove_wish", id);

Request parameters

NameTypeRequirementDescription
idnumber/stringrequiredThe ID of the product removed from the wishlist.

Example of use

pcsdk.track("remove_wish", "100500");

Custom event

Method Objective

The method gives the system an understanding that some user event has happened.

Before you can use custom events, you must create them in the PersonaClick account: Settings > Custom events.

Syntax and parameters

pcsdk.trackEvent(custom_event_key, params);

NameTypeRequirementDescription
custom_event_keystringrequiredUnique custom event key. Must be pre-created in the PersonaClick account: Settings > Custom events.
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
categorystringoptionallyA category is a name that you supply as a way to group some event's properties.
labelstringoptionallyWith labels, you can provide additional information for events that you need.
valuenumberoptionallyThe value property can be any integer and can be used to send a specific value in an event.

Examples of use

pcsdk.trackEvent("my_event");
pcsdk.trackEvent("my_event", {
	category: "my_category",
	label: "my_label",
	value: 100500
});


Push Notification Received

Method Objective

The method gives the system an understanding that the user has received a push notification.

Syntax and parameters

pcsdk.notificationReceived(params);


NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
typestringrequired

Message Type. Values are available in the payload of a message:

  • for iOS in the "src.type" property
  • for Android in the "type" property

See examples of payloads in the Payload Structure section.

codestringrequired

Message ID. Values are available in the payload of a message:

  • for iOS in the "src.id" property
  • for Android in the "id" property

See examples of payloads in the Payload Structure section.

Example of use

pcsdk.notificationReceived({type: "bulk", code: "01dadf45c301599865b402602f9dcf8f"});


Push Notification Clicked

Method Objective

The method gives the system an understanding that the user has clicked a push notification.

Syntax and parameters

pcsdk.notificationClicked(params);


NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
typestringrequired

Message Type. Values are available in the payload of a message:

  • for iOS in the "src.type" property
  • for Android in the "type" property

See examples of payloads in the Payload Structure section.

codestringrequired

Message ID. Values are available in the payload of a message:

  • for iOS in the "src.id" property
  • for Android in the "id" property

See examples of payloads in the Payload Structure section.

Example of use

pcsdk.notificationClicked({type: "chain", code: "5b40261dadf45c309902f9dcf8f10865"});

  • No labels