Showing
1 changed file
with
16 additions
and
4 deletions
@@ -9,6 +9,7 @@ class GoodsShowYasRpter { | @@ -9,6 +9,7 @@ class GoodsShowYasRpter { | ||
9 | C_ID: qs.physical_channel || 1, | 9 | C_ID: qs.physical_channel || 1, |
10 | DATA: [] | 10 | DATA: [] |
11 | }; | 11 | }; |
12 | + this.lastShowSkns = []; | ||
12 | 13 | ||
13 | window.onscroll = () => { | 14 | window.onscroll = () => { |
14 | window.requestAnimationFrame(() => { | 15 | window.requestAnimationFrame(() => { |
@@ -31,6 +32,8 @@ class GoodsShowYasRpter { | @@ -31,6 +32,8 @@ class GoodsShowYasRpter { | ||
31 | } | 32 | } |
32 | 33 | ||
33 | report() { | 34 | report() { |
35 | + let cacheTheShowSkns = []; // 暂存此次上报的商品,上报后复制给 lastReportSkns | ||
36 | + | ||
34 | $('.product-container').each((pcIndex, pCont) => { | 37 | $('.product-container').each((pcIndex, pCont) => { |
35 | let $pCont = $(pCont); | 38 | let $pCont = $(pCont); |
36 | let $floor = $pCont.parent(); | 39 | let $floor = $pCont.parent(); |
@@ -39,21 +42,30 @@ class GoodsShowYasRpter { | @@ -39,21 +42,30 @@ class GoodsShowYasRpter { | ||
39 | if ($.inviewport($pCont, { threshold: 0 })) { | 42 | if ($.inviewport($pCont, { threshold: 0 })) { |
40 | $pCont.find('.feature-product-info').each((pIindex, good) => { | 43 | $pCont.find('.feature-product-info').each((pIindex, good) => { |
41 | let $good = $(good); | 44 | let $good = $(good); |
45 | + let proSkn = $good.data('skn'); | ||
42 | 46 | ||
43 | if ($.inviewport($good, { threshold: 0 })) { | 47 | if ($.inviewport($good, { threshold: 0 })) { |
48 | + let indexInLast = this.lastShowSkns.indexOf(proSkn); | ||
49 | + | ||
50 | + if (indexInLast < 0) { | ||
44 | this.reportParams.DATA.push({ | 51 | this.reportParams.DATA.push({ |
45 | P_NAME: this.getPname(), | 52 | P_NAME: this.getPname(), |
46 | - P_PARAM: location.href, | 53 | + P_PARAM: location.href.split('?')[0], |
47 | F_INDEX: F_INDEX, | 54 | F_INDEX: F_INDEX, |
48 | - I_INDEX: pIindex, | ||
49 | - PRD_SKN: $good.data('skn') | 55 | + I_INDEX: pIindex + 1, |
56 | + PRD_SKN: proSkn | ||
50 | }); | 57 | }); |
51 | } | 58 | } |
59 | + | ||
60 | + cacheTheShowSkns.push(proSkn); | ||
61 | + } | ||
52 | }); | 62 | }); |
53 | } | 63 | } |
54 | }); | 64 | }); |
55 | 65 | ||
56 | - if (typeof _yas !== 'undefined') { | 66 | + this.lastShowSkns = cacheTheShowSkns; |
67 | + | ||
68 | + if (typeof _yas !== 'undefined' && this.reportParams.DATA && this.reportParams.DATA.length) { | ||
57 | window._yas.sendCustomInfo({ | 69 | window._yas.sendCustomInfo({ |
58 | op: 'YB_SHOW_EVENT', | 70 | op: 'YB_SHOW_EVENT', |
59 | appop: 'YB_SHOW_EVENT', | 71 | appop: 'YB_SHOW_EVENT', |
-
Please register or login to post a comment