PageSourceSearch

https://checkbox.ua/wp-content/plugins/salesdrive/js/salesdrive.js

js checkbox.ua collected 2026-10-02 06:35:39 UTC 5,316 bytes, 147 lines download raw bytes

1(function() {
2 function getCookie(name) {
3    var matches = document.cookie.match(new RegExp(
4      "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)"
5    ))
6    return matches ? decodeURIComponent(matches[1]) : undefined
7 }
8
9 function setCookie(name, value, props) {
10    props = props || {}
11    var exp = props.expires
12    if (typeof exp == "number" && exp) {
13       var d = new Date()
14       d.setTime(d.getTime() + exp * 1000 * 86400)
15       exp = props.expires = d
16    }
17    if(exp && exp.toUTCString) { props.expires = exp.toUTCString() }
18
19    value = decodeURIComponent(value)
20    var updatedCookie = name + "=" + value
21    for(var propName in props){
22       updatedCookie += "; " + propName
23       var propValue = props[propName]
24       if(propValue !== true){ updatedCookie += "=" + propValue }
25    }
26    document.cookie = updatedCookie
27 }
28
29 function parseURL(url) {
30    var a =  document.createElement("a");
31    a.href = url;
32    return {
33       source: url,
34       protocol: a.protocol.replace(":",""),
35       host: a.hostname,
36       port: a.port,
37       query: a.search,
38       params: (function(){
39          var ret = {},
40             seg = a.search.replace(/^\?/,"").split("&"),
41             len = seg.length, i = 0, s;
42          for (;i<len;i++) {
43             if (!seg[i]) { continue; }
44             s = seg[i].split("=");
45             ret[s[0]] = s[1];
46          }
47          return ret;
48       })(),
49       file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,""])[1],
50       hash: a.hash.replace("#",""),
51       path: a.pathname.replace(/^([^\/])/,"/$1"),
52       relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,""])[1],
53       segments: a.pathname.replace(/^\//,"").split("/")
54    };
55 }
56
57 function parseGetParams() {
58    var $_GET = {};
59    var __GET = window.location.search.substring(1).split("&");
60    for(var i=0; i<__GET.length; i++) {
61       var getVar = __GET[i].split("=");
62       $_GET[getVar[0]] = typeof(getVar[1])=="undefined" ? "" : decodeURIComponent(getVar[1]);
63    }
64
65    return $_GET;
66 }
67
68 function setCookieThisDomain(hostname_arr, i)
69 {
70    var this_domain_tmp = hostname_arr.slice(i).join(".");
71    var cookie_param = {expires: 365, path: "/", domain: "." + this_domain_tmp}
72    setCookie("prodex24cur_domain", this_domain_tmp, cookie_param);
73    var tmp_m = getCookie("prodex24cur_domain");
74    if (typeof(tmp_m) == "undefined")
75    {
76       i--;
77       if (i < 0)
78          return;
79
80       setCookieThisDomain(hostname_arr, i);
81    }
82 }
83
84 var hostname = location.host || location.hostname;
85 var hostname_arr = hostname.split(".");
86 var len = hostname_arr.length - 2;
87 setCookieThisDomain(hostname_arr, len);
88 this_domain = getCookie("prodex24cur_domain");
89 var cookie_param = {expires: 365, path: "/", domain: "." + this_domain};
90 
91 var refer = document.referrer || location.referrer;
92 
93 var get = parseGetParams();
94 if (typeof(get.utm_expid) != "undefined")
95 {
96    //setCookie("prodex24experiment", get.utm_expid, cookie_param);
97 }
98
99 var myURL = parseURL(refer);
100 myURLhost = myURL.host;
101
102 if (typeof(get.utm_source) != "undefined" || typeof(get.utm_medium) != "undefined" || typeof(get.utm_campaign) != "undefined" || typeof(get.utm_content) != "undefined" || typeof(get.utm_term) != "undefined" || typeof(get.yclid) != "undefined" || typeof(get.gclid) != "undefined")
103 {
104    setCookie("prodex24source", get.utm_source || "", cookie_param);
105    if (typeof(get.utm_source) == "undefined")
106    {
107       if (typeof(get.gclid) != "undefined")
108       {setCookie("prodex24source", "google", cookie_param);}
109    }
110
111    setCookie("prodex24medium", get.utm_medium || "", cookie_param);
112    if (typeof(get.utm_medium) == "undefined")
113    {
114       if (typeof(get.yclid) != "undefined")
115       {setCookie("prodex24medium", "cpc", cookie_param);}
116       if (typeof(get.gclid) != "undefined")
117       {setCookie("prodex24medium", "cpc", cookie_param);}
118    }
119    setCookie("prodex24campaign", get.utm_campaign || "", cookie_param);
120    setCookie("prodex24content", get.utm_content || "", cookie_param);
121    setCookie("prodex24term", get.utm_term || "", cookie_param);
122
123    if (refer && myURLhost.indexOf(window.location.hostname) == -1 && window.location.hostname.indexOf(myURLhost) == -1)
124    {setCookie("prodex24source_full", refer || "", cookie_param);}
125 }
126 else if (refer)
127 {
128    if  (myURLhost.indexOf(window.location.hostname) == -1 && window.location.hostname.indexOf(myURLhost) == -1)
129    {
130       setCookie("prodex24source_full", refer, cookie_param);
131       var domain = myURL.host.replace(/^www\./i, "");
132       setCookie("prodex24source", domain, cookie_param);
133
134       if (typeof(get.gclid) != "undefined")
135       {setCookie("prodex24medium", "cpc", cookie_param);}
136       else if (/^(((google|search\.yahoo|yandex|bing)(\.[^.]+)+)|(rambler\.ru)|(ukr\.net)|(mail\.ru))$/i.test(domain))
137       {setCookie("prodex24medium", "organic", cookie_param);}
138       else
139       {setCookie("prodex24medium", "referral", cookie_param);}
140
141       setCookie("prodex24campaign", "", cookie_param);
142       setCookie("prodex24content", "", cookie_param);
143       setCookie("prodex24term", "", cookie_param);
144
145    }
146 }
147})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.