Skip to content

Instantly share code, notes, and snippets.

@vchub
Last active December 21, 2015 19:19
Show Gist options
  • Save vchub/6353443 to your computer and use it in GitHub Desktop.
Save vchub/6353443 to your computer and use it in GitHub Desktop.
Example of adding REC_CLICK event handling to reco-box. Just an idea, not suggestion for implementation
_gravity.push({type : 'recommendation',
callback: callback_fn,
numberLimit: 4,
scenarioId: "CATEGORY_PAGE",
currentItemId: "xxx",
itemOnPage: [], // [] of itemIds already displayed on the page
resultNames: ["itemId"],
// фильтр по категории
// т.е. мы хотим получить реко на товары из категории 1
categoryId: "1"
});
// Example of adding REC_CLICK event handling to reco-box
// Just an idea, not suggestion for implementation
var i = 0;
$("t20_goods_block").each(function(){
$(this).mousedown(function(){
_gravity = _gravity || [];
_gravity.push({
type: 'event',
eventType: 'REC_CLICK',
// result is data received in recommendation request
// for own reco-boxes that don't use gravity, a fixed value is used
// e.g. recommendationId: "OWN_ITEM_PAGE",
recommendationId: result.recommendationId,
itemId: result.items[i].itemid,
});
});
i++;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment