1// SETTINGS \\ 2var apilink = "https://insightsectr.bpweb.net/"; 3var id = "insight"; 4if (!session_id) {var session_id = '';} 5var click_tracking = 'Y'; 6 7if (!pphlogevents) {var pphlogevents = '';} 8if (!pphlogsearch) {var pphlogsearch = '';} 9 10function getCookie(name) { 11 var nameEQ = name + "="; 12 var ca = document.cookie.split(';'); 13 for(var i=0;i < ca.length;i++) { 14 var c = ca[i]; 15 while (c.charAt(0)==' ') c = c.substring(1,c.length); 16 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 17 } 18 return null; 19} 20var visitor_id = (getCookie(id)?getCookie(id):'0'); 21 22// get the screen size -------------------------------------- 23s = screen.width+"x"+screen.height; 24 25// get the document's title --------------------------------- 26t = escape(document.title); 27 28// get the document's referrer ------------------------------- 29var f = ""; 30 31// if pp_frames is true then try getting the framed referral (without error checking) 32if (typeof(pp_frames) != "undefined") 33 if (pp_frames) 34 f = top.document.referrer; 35 36// get the referral for non-multi-domained-framed sites using a Netscape browser 37if ((f == "") || (f == "[unknown origin]") || (f == "unknown") || (f == "undefined")) 38 if (document["parent"] != null) 39 if (parent["document"] != null) // ACCESS ERROR HERE! 40 if (parent.document["referrer"] != null) 41 if (typeof(parent.document) == "object") 42 f = parent.document.referrer; 43 44// get the referral for the current document if a framed referral wasn't found 45if ((f == "") || (f == "[unknown origin]") || (f == "unknown") || (f == "undefined")) 46 if (document["referrer"] != null) 47 f = document.referrer; 48 49// convert all the unknown's into blank 50if ((f == "") || (f == "[unknown origin]") || (f == "unknown") || (f == "undefined")) 51 f = ""; 52 53// escape the referral 54f = escape(f); 55 56// getting data ready to send ------------------------------- 57r="?id="+id+"&referer="+f+"&r="+s+"&title="+t+"&url="+document.URL; 58 59$.ajax({ 60 url: apilink+"tracker.php"+r, 61 type: 'POST', 62 data: { 63 'session_id': session_id, 64 'visitor_id': visitor_id, 65 'click_data': (getCookie(id+'_clicks')&&getCookie(id+'_clicks')>''?getCookie(id+'_clicks'):''), 66 'pphlogevents': pphlogevents, 67 'pphlogsearch': pphlogsearch 68 }, 69 success: function(data) { 70 //console.log('done',data); 71 var name = id; 72 var value = data.visitorid; 73 if (value > 0) 74 { 75 var expires = ""; 76 var date = new Date(); 77 date.setTime(date.getTime() + (5*52*7*24*60*60*1000)); 78 expires = "; expires=" + date.toUTCString(); 79 //console.log(expires); 80 document.cookie = name + "=" + (value || "") + expires + "; path=/; SameSite=None;"+(document.URL.indexOf('https')>-1?' Secure':''); 81 82 if (click_tracking == 'Y') 83 { 84 var name = id+'_clicks'; 85 document.cookie = name + "=" + ("") + ";" + date.setTime(date.getTime() + (2*60*60*1000)) + "; path=/; SameSite=None;"+(document.URL.indexOf('https')>-1?' Secure':''); 86 } 87 88 // FORM TRACKING \\ 89 $('form.fmlogger').on('submit', function(event) { 90 event.preventDefault(); 91 var $this = $(this); 92 var fmname = $this.attr('name'); 93 if (fmname > '') 94 { 95 var fields = $this.serializeArray(); 96 fielddata = {}; 97 98 $.each(fields, function(index, data) { 99 fielddata[data['name']] = (data['value']>''?'NOT-EMPTY':'EMPTY'); 100 }); 101 102 //console.log(fields, fielddata, JSON.stringify(fielddata)); 103 104 $.ajax({ 105 url: apilink+"tracker.php?fmlogger=true&id="+id, 106 type: 'POST', 107 data: { 108 'session_id': session_id, 109 'visitor_id': visitor_id, 110 'fmname': fmname, 111 'fmurl': document.URL, 112 'fmdata': btoa(JSON.stringify(fielddata)) 113 }, 114 success: function(data) { 115 if (data.spam == false) 116 { 117 $this.unbind('submit').submit(); 118 } 119 }, 120 error: function() { 121 //console.log('failed'); 122 } 123 }); 124 } 125 }); 126 } 127 var value = data.redirect; 128 if (value > '') 129 { 130 window.location = "http://"+value; 131 } 132 }, 133 error: function() { 134 //console.log('failed'); 135 } 136});
137 138// CLICK TRACKER \\ 139if (click_tracking == 'Y') 140{ 141 jQuery.fn.tagNameLowerCase = function() { 142 return this.prop("tagName").toLowerCase(); 143 }; 144 $('a[href]').on('click', function(event) { 145 var href = $(this).prop('href'); 146 if ($(this).attr('href') > '') 147 { 148 var href_str = href.replace((document.URL.indexOf('https')>-1?'https://':'http://'),'').split('/')[1]; 149 if (!href_str) 150 { 151 href_str = href.replace((document.URL.indexOf('https')>-1?'https://':'http://'),''); 152 } 153 /* 154 console.log( 155 href_str.indexOf('.php'), 156 href_str.indexOf('.html'), 157 href_str.indexOf('.'), 158 href_str != document.URL.replace((document.URL.indexOf('https')>-1?'https://':'http://'),'').split('/')[1] 159 ); 160 */ 161 if ( 162 ( 163 href_str.indexOf('.php') > -1 || 164 href_str.indexOf('.html') > -1 || 165 href_str.indexOf('.') < 0 166 ) 167 && 168 href_str != document.URL.replace((document.URL.indexOf('https')>-1?'https://':'http://'),'').split('/')[1] 169 ) 170 { 171 event.preventDefault(); 172 173 var el_parent = $(this).parent(); 174 var linkref = ''; 175 var linktag = ''; 176 var i = 0; 177 178 while (linktag != 'body') 179 { 180 var linktag = $(el_parent).tagNameLowerCase(); 181 linkref = linktag+(linkref>''?'_'+linkref:''); 182 //console.log(linktag, linkref); 183 var el_parent = $(el_parent).parent(); 184 i++; 185 if (i == 1000) {window.stop();} 186 } 187 188 var name = id+'_clicks'; 189 var value = linkref+'|'+href_str; 190 //console.log(linkref,href,value); 191 192 var expires = ""; 193 var date = new Date(); 194 date.setTime(date.getTime() + (2*60*60*1000)); 195 expires = "; expires=" + date.toUTCString(); 196 //console.log(expires); 197 document.cookie = name + "=" + (value || "") + expires + "; path=/; SameSite=None;"+(document.URL.indexOf('https')>-1?' Secure':''); 198 199 if ($(this).attr('target') > '') 200 { 201 setTimeout(function() { 202 window.open(href, $(this).attr('target')); 203 },200); 204 } 205 else 206 { 207 setTimeout(function() { 208 window.location = href; 209 },200); 210 } 211 } 212 } 213 }); 214 215 // HEAT MAP \\ 216 if (heatmap_js != 'false') 217 { 218 $(document).ready(function() { 219 $('body').prop('id','heatmapContainer'); 220 $('script').last().after( 221 '<script src="https://www.mysitestats.co.uk/heatmap/heatmap.js"></script>' 222 ); 223 setTimeout(function() { 224 $('script').last().after( 225 '<link href="https://www.mysitestats.co.uk/heatmap/heatmap.css" rel="stylesheet">'+ 226 '<script src="https://www.mysitestats.co.uk/heatmap/heatmap_custom.js"></script>' 227 ); 228 },150); 229 }); 230 } 231}
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.