Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Get Product Counters

Method Objective

The method allows getting 24-hour and 15-minute counters of interaction with a product.

Syntax and parameters

Code Block
languagejs
themeFadeToGrey
personaclick("products", "counters", product_id, success, error);

NameTypeRequirementDescription
product_idnumber/stringrequiredProduct ID.
successfunctionrequiredA callback function, to which the API response will be passed. Response type: object.
errorfunctionoptionallyA callback function that will be called when an error occurs (any HTTP status code other than 200).

API response

Name

Type

Description

nowobject

The product interaction counters for the last 15 minutes. 

The following properties are available:

  • view (number) - the number of product views
  • cart (number) - the number of times product is added to the cart
  • purchase (number) - the number of product purchases
dailyobject

The product interaction counters for the last 24 hours. 

The following properties are available:

  • view (number) - the number of product views
  • cart (number) - the number of times product is added to the cart
  • purchase (number) - the number of product purchases

Example of use

Code Block
languagejs
themeFadeToGrey
personaclick("products", "counters", 100500, function(counters) {
	console.log(counters.now.view);        // views in the last 15 minutes
    console.log(counters.daily.purchase);  // purchases in the last 24 hours
});


Get User's Current Cart

Method Objective

The method allows getting the current profile's cart.

Syntax and parameters

Code Block
languagejs
themeFadeToGrey
personaclick("cart", "get", success, error);


NameTypeRequirementDescription
successfunctionrequiredA callback function, to which the API response will be passed. Response type: object.
errorfunctionoptionallyA callback function that will be called when an error occurs (any HTTP status code other than 200).

API response

Name

Type

Description

statusstringContains "success" if the request is successful.
dataobject

Contains the "items" object array, where each object contains the following properties:

  • uniqid - product ID
  • quantity - product quantity

Example of use

Code Block
languagejs
themeFadeToGrey
personaclick("cart", "get", function(cart) {
	console.log(cart.data.items);
});



Column

Page Navigation

Table of Contents
maxLevel2
indent0px
stylenone




Related Pages

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