Last active
December 21, 2015 19:19
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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" | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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