-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
35 lines (32 loc) · 1.05 KB
/
test.js
File metadata and controls
35 lines (32 loc) · 1.05 KB
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
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
var sessionId = getCookie("cart");
if(sessionId) {
if(sessionId !== getCookie("KountCookie")) {
var url = "https://sandbox01.kaxsdc.com/collect/sdk?m=999666&s=" + sessionId;
var script = document.createElement('script');
script.src = url;
script.type = "text/javascript";
document.head.appendChild(script);
setCookie("KountCookie", sessionId, 365);
}
}