Authored by 郭成尧

yas-report-modified

... ... @@ -9,6 +9,7 @@ class GoodsShowYasRpter {
C_ID: qs.physical_channel || 1,
DATA: []
};
this.lastShowSkns = [];
window.onscroll = () => {
window.requestAnimationFrame(() => {
... ... @@ -31,6 +32,8 @@ class GoodsShowYasRpter {
}
report() {
let cacheTheShowSkns = []; // 暂存此次上报的商品,上报后复制给 lastReportSkns
$('.product-container').each((pcIndex, pCont) => {
let $pCont = $(pCont);
let $floor = $pCont.parent();
... ... @@ -39,21 +42,30 @@ class GoodsShowYasRpter {
if ($.inviewport($pCont, { threshold: 0 })) {
$pCont.find('.feature-product-info').each((pIindex, good) => {
let $good = $(good);
let proSkn = $good.data('skn');
if ($.inviewport($good, { threshold: 0 })) {
this.reportParams.DATA.push({
P_NAME: this.getPname(),
P_PARAM: location.href,
F_INDEX: F_INDEX,
I_INDEX: pIindex,
PRD_SKN: $good.data('skn')
});
let indexInLast = this.lastShowSkns.indexOf(proSkn);
if (indexInLast < 0) {
this.reportParams.DATA.push({
P_NAME: this.getPname(),
P_PARAM: location.href.split('?')[0],
F_INDEX: F_INDEX,
I_INDEX: pIindex + 1,
PRD_SKN: proSkn
});
}
cacheTheShowSkns.push(proSkn);
}
});
}
});
if (typeof _yas !== 'undefined') {
this.lastShowSkns = cacheTheShowSkns;
if (typeof _yas !== 'undefined' && this.reportParams.DATA && this.reportParams.DATA.length) {
window._yas.sendCustomInfo({
op: 'YB_SHOW_EVENT',
appop: 'YB_SHOW_EVENT',
... ...