This API returns the views and purchases of one or more products over different time periods.
Function Declaration
function getProductsData(skus, timeframes, includeProductInterest, includeProductData, callback)
Parameters
- skus. Syntax: List[String]. An array of up to 20 product SKUs.
- timeframes. Syntax: List[String]. An array of one or more values defining the timeframe going back. If undefined, returns values for all time periods. The values can be:
- daily
- twoDays
- weekly
- twoWeeks
- monthly
- includeProductInterest. Determines if viewing data, purchase data, or both are returned. If undefined, both are returned. The values can be:
- View
- Purchase
- includeProductData. Determines whether or not to display product attributes and details such as color, style, etc. The values can be true or false.
- callback. The callback function
Example Call
DY.ServerUtil.getProductsData(["1217282-400", "1217282-600"], ['daily', 'twoDays'], 'view', false, function(err, res) { console.log(res)})
Example Response
{
"1217282-400": {
"productInterest": {
"view": {
"daily": 1,
"twoDays": 1
},
"city": {
"view": {},
"purchase": {}
}
}
},
"1217282-600": {
"productInterest": {
"view": {
"daily": 1,
"twoDays": 1
},
"city": {
"view": {},
"purchase": {}
}
}
}
}