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