|
| 1 | +<html> |
| 2 | +<title>Event/Query</title> |
| 3 | +<head> |
| 4 | +<meta charset="UTF-8"> |
| 5 | +<title>Insert title here</title> |
| 6 | + |
| 7 | +<script id="etu-recommender" type="text/javascript"> |
| 8 | + var erHostname='210.63.38.209'; |
| 9 | + var erUrlPrefix='210.63.38.209';//for local test |
| 10 | + |
| 11 | + |
| 12 | + var _qevents = _qevents || []; |
| 13 | + _qevents.push({ |
| 14 | + cid : 'user-behavior-com', |
| 15 | + act : 'view', |
| 16 | + pid : '145510', |
| 17 | + cat : 'cat01', |
| 18 | + abc : 'aaaa', |
| 19 | + group : 'UDN', |
| 20 | + ptuple: [ |
| 21 | + { |
| 22 | + paypid:"U049132", |
| 23 | + qty:"1", |
| 24 | + unit_price:"100", |
| 25 | + pcat:"A,A01,A01_001", |
| 26 | + pmk:"discount,festival" |
| 27 | + } |
| 28 | + ] |
| 29 | + //plist : '1377003,1,99', |
| 30 | + //oid : 'orderdh003' |
| 31 | + }); |
| 32 | + |
| 33 | + function getCustomizeActionData(){ |
| 34 | + |
| 35 | + } |
| 36 | + |
| 37 | + //var _qeventList = [ _qevents1,_qevents2 ]; |
| 38 | + /* |
| 39 | + */ |
| 40 | + /* |
| 41 | + var _qquery = _qquery || []; |
| 42 | +
|
| 43 | + _qquery.push({ |
| 44 | + cid : 'user-behavior-com', |
| 45 | + type : 'item', |
| 46 | + act : 'cart', |
| 47 | + pid : 'pid393', |
| 48 | + cmopl:'0' |
| 49 | + }); |
| 50 | + */ |
| 51 | + |
| 52 | +/* |
| 53 | +//0007057 : query cat=中分類 |
| 54 | +var strCat = ""; |
| 55 | +var catList = []; |
| 56 | +catList.push('G'); |
| 57 | +catList.push('G_020'); |
| 58 | +catList.push('G_020_007'); |
| 59 | +catList.push('G_020_007_004'); |
| 60 | +catList.push('G_020_007_004_004'); |
| 61 | +strCat = catList[catList.length-1]; |
| 62 | +*/ |
| 63 | + |
| 64 | +//erUid=3bbe6329-231-8737-7d73-93465a80f390 |
| 65 | + |
| 66 | + var _qquery1 = _qquery1 || []; |
| 67 | + var _qquery2 = _qquery2 || []; |
| 68 | + var _qquery3 = _qquery3 || []; |
| 69 | + |
| 70 | + /* |
| 71 | + //ADs |
| 72 | + _qquery1.push({ |
| 73 | + cid : 'user-behavior.com', |
| 74 | + type : 'user', |
| 75 | + act : 'view', |
| 76 | + uid: 'Usr41', |
| 77 | + alg : 'ad_most_freq', |
| 78 | + imgH: '80', |
| 79 | + imgW: '360', |
| 80 | + qname:'Q1' |
| 81 | + }); |
| 82 | + */ |
| 83 | + |
| 84 | + _qquery1.push({ |
| 85 | + cid : 'user-behavior-com', |
| 86 | + type : 'user', |
| 87 | + act : 'view', |
| 88 | + uid : 'Usr145', |
| 89 | + compl:'0', |
| 90 | + qname:'Q1' |
| 91 | + //cat : strCat |
| 92 | + |
| 93 | + }); |
| 94 | + |
| 95 | + _qquery2.push({ |
| 96 | + cid : 'user-behavior-com', |
| 97 | + type : 'item', |
| 98 | + act : 'view', |
| 99 | + pid : 'pid393', |
| 100 | + compl:'0', |
| 101 | + qname:'Q2' |
| 102 | + //cat : strCat |
| 103 | + }); |
| 104 | + |
| 105 | + _qquery3.push({ |
| 106 | + cid : 'user-behavior-com', |
| 107 | + type : 'item', |
| 108 | + act : 'order', |
| 109 | + pid : 'pid393', |
| 110 | + alg : 'co_occurrence', |
| 111 | + compl:'0', |
| 112 | + qname:'Q3' |
| 113 | + //cat : strCat |
| 114 | + }); |
| 115 | + |
| 116 | + var _qqueryList = [ _qquery1 , _qquery2, _qquery3 ]; |
| 117 | + |
| 118 | + function etuRecQueryCallBack(queryParams,queryResult) { |
| 119 | + //implement UI code here |
| 120 | + if('Q1' == queryParams['qname']){//Q1 |
| 121 | + document.getElementById('result1').innerText=queryResult.toString(); |
| 122 | + }else if ('Q2' == queryParams['qname']){ //Q2 |
| 123 | + document.getElementById('result2').innerText=queryResult.toString(); |
| 124 | + }else if ('Q3' == queryParams['qname']){ //Q3 |
| 125 | + document.getElementById('result3').innerText=queryResult.toString(); |
| 126 | + }else{ |
| 127 | + //do nothing |
| 128 | + alert("Error"); |
| 129 | + } |
| 130 | + } |
| 131 | + var erUrlPrefix=('https:' == document.location.protocol ?'https://':'http://')+erHostname+'/'; |
| 132 | + |
| 133 | + function ERsend(){ |
| 134 | + _qevents = []; |
| 135 | + _qevents.push({ |
| 136 | + cid : 'user-behavior-com', |
| 137 | + act : 'order', |
| 138 | + pid : '145510', |
| 139 | + cat : 'cat0143423', |
| 140 | + abc : 'bbbb', |
| 141 | + group : 'UDN', |
| 142 | + ptuple: [ |
| 143 | + { |
| 144 | + paypid:"U049132", |
| 145 | + qty:"10000", |
| 146 | + unit_price:"100", |
| 147 | + pcat:"A,A01,A01_001", |
| 148 | + pmk:"discount,festival" |
| 149 | + } |
| 150 | + ] |
| 151 | + //plist : '1377003,1,99', |
| 152 | + //oid : 'orderdh003' |
| 153 | + }); |
| 154 | + _qquery1 = []; |
| 155 | + _qquery2 = []; |
| 156 | + _qquery3 = []; |
| 157 | + _qquery1.push({ |
| 158 | + cid : 'user-behavior-com', |
| 159 | + type : 'user', |
| 160 | + act : 'view', |
| 161 | + uid : 'Usr145', |
| 162 | + compl:'0', |
| 163 | + qname:'Q1' |
| 164 | + //cat : strCat |
| 165 | + |
| 166 | + }); |
| 167 | + |
| 168 | + _qquery2.push({ |
| 169 | + cid : 'user-behavior-com', |
| 170 | + type : 'item', |
| 171 | + act : 'view', |
| 172 | + pid : 'pid393', |
| 173 | + compl:'0', |
| 174 | + qname:'Q2' |
| 175 | + //cat : strCat |
| 176 | + }); |
| 177 | + |
| 178 | + _qquery3.push({ |
| 179 | + cid : 'user-behavior-com', |
| 180 | + type : 'item', |
| 181 | + act : 'order', |
| 182 | + pid : 'pid393', |
| 183 | + alg : 'co_occurrence', |
| 184 | + compl:'0', |
| 185 | + qname:'Q3' |
| 186 | + //cat : strCat |
| 187 | + }); |
| 188 | + var _qqueryList = [ _qquery1 , _qquery2, _qquery3 ]; |
| 189 | + |
| 190 | + /** Send action **/ |
| 191 | + ER.track.send(_qevents, [], '', _qqueryList); |
| 192 | + } |
| 193 | + (function() { |
| 194 | + var er = document.createElement('script'); |
| 195 | + er.type = 'text/javascript'; |
| 196 | + er.async = true; |
| 197 | + er.src = erUrlPrefix+'er.js?'+(new Date().getDate()); |
| 198 | + var currentJs=document.getElementById('etu-recommender'); |
| 199 | + currentJs.parentNode.insertBefore(er,currentJs); |
| 200 | + })(); |
| 201 | + |
| 202 | + //get 'ETU_REC_user-behavior.com_ITEM' ,'-1006363824609882436' |
| 203 | + //get 'ETU_REC_user-behavior.com_USER' ,'-1063921717445558817' |
| 204 | + /* |
| 205 | + * f:avl_cat timestamp=1402825180073, value=1 |
| 206 | + f:avl_item timestamp=1402825159905, value=1 |
| 207 | + f:cat timestamp=1402825159905, value=cat_odd,%E7%A8%AE%E9%A1%9E%2F4 |
| 208 | + f:id timestamp=1402825159905, value=pid393 |
| 209 | + f:pry timestamp=1402825159905, value=0 |
| 210 | + f:rec_cart timestamp=1402824612979, value=pid318,pid304,pid314,pid345,pid398,pid302, |
| 211 | + pid364 |
| 212 | + f:rec_order timestamp=1402824625837, value=pid379,pid345,pid349,pid398,pid344,pid304, |
| 213 | + pid358 |
| 214 | + f:rec_order_co_occurrence timestamp=1402825232571, value=pid399 |
| 215 | + f:rec_view timestamp=1402824627661, value=pid379,pid364,pid386,pid318 |
| 216 | + */ |
| 217 | + |
| 218 | +</script> |
| 219 | + |
| 220 | + |
| 221 | +</head> |
| 222 | +<body> |
| 223 | + |
| 224 | + |
| 225 | + <script type="text/javascript"> |
| 226 | +var cookieName = 'HelloWorld'; |
| 227 | +var cookieValue = 'HelloWorld'; |
| 228 | +var myDate = new Date(); |
| 229 | +myDate.setMonth(myDate.getMonth() + 12); |
| 230 | +console.log(document.cookie); |
| 231 | +document.cookie =''; |
| 232 | +//document.cookie = document.cookie +";"+cookieName +"=" + cookieValue + ";expires=" + myDate + ";domain=localhost;path=/"; |
| 233 | + |
| 234 | + console.log(document.cookie); |
| 235 | +</script> |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + result_user_order: <p id="result1"></p> |
| 240 | + result_item_view: <p id="result2"></p> |
| 241 | + result_item_order_co_ocurrence: <p id="result3"></p> |
| 242 | + <button type="button" onclick="document.cookie="abc=123;domain=localhost;path=/"">Create Cookie 1</button> |
| 243 | + <button type="button" onclick="document.cookie="lastname=Smith;path=/;expires=Wed, 18 Dec 2023 12:00:00 GMT"">Create Cookie 2</button> |
| 244 | + <button type="button" onclick="document.cookie="filename=derek;expires=Wed, 18 Dec 2017 12:00:00 GMT"">Create Cookie 3</button> |
| 245 | + <button class = "test" type = "button" onclick = "ERsend()"></button> |
| 246 | +</body> |
| 247 | + |
| 248 | +</html> |
| 249 | + |
0 commit comments