Merge branch 'feature/detailyas' into release/5.4.1
Showing
1 changed file
with
54 additions
and
59 deletions
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2016-05-18 11:42:11 | 3 | * @Date: 2016-05-18 11:42:11 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-02-21 10:03:05 | 5 | + * @Last Modified time: 2017-02-21 10:29:03 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 'use strict'; | 8 | 'use strict'; |
@@ -63,66 +63,61 @@ module.exports = (data) => { | @@ -63,66 +63,61 @@ module.exports = (data) => { | ||
63 | result = $.load(result)('#goods-container').append( | 63 | result = $.load(result)('#goods-container').append( |
64 | `<script type="text/javascript"> | 64 | `<script type="text/javascript"> |
65 | (function() { | 65 | (function() { |
66 | - var qs = {}; | ||
67 | - var hashes = window.location.search.slice(1).split('&'); | ||
68 | - for (var i = 0; i < hashes.length; i++) { | ||
69 | - var hash = hashes[i].split('='); | ||
70 | - qs[hash[0]] = hash[1]; | ||
71 | - } | ||
72 | - var uid = ''; | ||
73 | - window._ozuid = uid; // 暴露ozuid | ||
74 | - if (window._yas) { | ||
75 | - window._yas(1 * new Date(), '2.0.0', 'yohobuy_m', uid, '', ''); | ||
76 | - } | ||
77 | - | ||
78 | - // 店铺推荐点击商品 埋点 | ||
79 | - var C_ID = qs.yh_channel || 1; | ||
80 | - var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) + '_' + Math.floor(Math.random() * 1000000 + 1000000)); | ||
81 | - | ||
82 | - var goodDom = document.getElementsByClassName("good-info"); | ||
83 | - for(var i = 0; i < goodDom.length; i++) { | ||
84 | - goodDom[i].addEventListener('click', function(e) { | ||
85 | - if (!window._yas || !window._yas.sendAppLogs) { | ||
86 | - return; | ||
87 | - } | 66 | + var qs = {}; |
67 | + var hashes = window.location.search.slice(1).split('&'); | ||
68 | + for (var i = 0; i < hashes.length; i++) { | ||
69 | + var hash = hashes[i].split('='); | ||
70 | + qs[hash[0]] = hash[1]; | ||
71 | + } | ||
88 | 72 | ||
89 | - var PRD_ID = e.currentTarget.getAttribute('data-good-id'); | ||
90 | - var PRD_NUM = e.currentTarget.getAttribute('data-good-index'); | ||
91 | - window._yas.sendAppLogs({ | ||
92 | - appop: 'YB_CHOOSE_FOR_YOU', | ||
93 | - param: JSON.stringify({ | ||
94 | - REC_POSE: 100013, | ||
95 | - REC_ID: RECID, | ||
96 | - PRD_ID: PRD_ID, | ||
97 | - PRD_NUM: PRD_NUM, | ||
98 | - C_ID: C_ID, | ||
99 | - ACTION_ID: 1 | ||
100 | - }) | ||
101 | - }, true); | ||
102 | - }, false); | ||
103 | - } | ||
104 | - | ||
105 | - // 店铺推荐展示 埋点 | ||
106 | - setTimeout(function(){ | ||
107 | - // 店铺推荐展示 埋点 | ||
108 | - if (window._yas && typeof window._yas.sendAppLogs === 'function') { | ||
109 | - var prdIds = document.getElementById('prdIds') || {}; | ||
110 | - var ids = prdIds.getAttribute('value') || ''; | ||
111 | - | ||
112 | - window._yas.sendAppLogs({ | ||
113 | - appop: 'YB_CHOOSE_FOR_YOU', | ||
114 | - param: JSON.stringify({ | ||
115 | - REC_POSE: 100013, | ||
116 | - REC_ID: RECID, | ||
117 | - PRD_ID: ids, | ||
118 | - PRD_NUM: ids.split(',').length, | ||
119 | - C_ID: C_ID, | ||
120 | - ACTION_ID: 0 | ||
121 | - }) | ||
122 | - }, true); | 73 | + // 店铺推荐点击商品 埋点 |
74 | + var C_ID = qs.yh_channel || 1; | ||
75 | + var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) + '_' + Math.floor(Math.random() * 1000000 + 1000000)); | ||
76 | + | ||
77 | + var goodDom = document.getElementsByClassName("good-info"); | ||
78 | + for(var i = 0; i < goodDom.length; i++) { | ||
79 | + goodDom[i].addEventListener('click', function(e) { | ||
80 | + if (!window._yas || !window._yas.sendAppLogs) { | ||
81 | + return; | ||
82 | + } | ||
83 | + | ||
84 | + var PRD_ID = e.currentTarget.getAttribute('data-good-id'); | ||
85 | + var PRD_NUM = e.currentTarget.getAttribute('data-good-index'); | ||
86 | + window._yas.sendAppLogs({ | ||
87 | + appop: 'YB_CHOOSE_FOR_YOU', | ||
88 | + param: JSON.stringify({ | ||
89 | + REC_POSE: 100013, | ||
90 | + REC_ID: RECID, | ||
91 | + PRD_ID: PRD_ID, | ||
92 | + PRD_NUM: PRD_NUM, | ||
93 | + C_ID: C_ID, | ||
94 | + ACTION_ID: 1 | ||
95 | + }) | ||
96 | + }, true); | ||
97 | + }, false); | ||
123 | } | 98 | } |
124 | - }, 2000); | ||
125 | - }());</script>` | 99 | + |
100 | + // 店铺推荐展示 埋点 | ||
101 | + setTimeout(function(){ | ||
102 | + // 店铺推荐展示 埋点 | ||
103 | + if (window._yas && typeof window._yas.sendAppLogs === 'function') { | ||
104 | + var prdIds = document.getElementById('prdIds') || {}; | ||
105 | + var ids = prdIds.getAttribute('value') || ''; | ||
106 | + | ||
107 | + window._yas.sendAppLogs({ | ||
108 | + appop: 'YB_CHOOSE_FOR_YOU', | ||
109 | + param: JSON.stringify({ | ||
110 | + REC_POSE: 100013, | ||
111 | + REC_ID: RECID, | ||
112 | + PRD_ID: ids, | ||
113 | + PRD_NUM: ids.split(',').length, | ||
114 | + C_ID: C_ID, | ||
115 | + ACTION_ID: 0 | ||
116 | + }) | ||
117 | + }, true); | ||
118 | + } | ||
119 | + }, 2000); | ||
120 | + }());</script>` | ||
126 | ).html(); | 121 | ).html(); |
127 | return result; | 122 | return result; |
128 | }); | 123 | }); |
-
Please register or login to post a comment