1if (typeof wm_indiv_stats == 'undefined') { 2 wm_indiv_stats = new Object(); // object to add the individual parameters 3} 4 5(function(){ 6 7 /** 8 * Creates the wiredminds literal object and returns it. 9 * 10 * @return object 11 */ 12 function getWiredMinds() { 13 var wiredminds = { 14 15 getlist : "", 16 17 www_server : "www.count.carrierzone.com", 18 app_server : "www.count.carrierzone.com", 19 cnt_server : "count.carrierzone.com", 20 app_server_proto : "", 21 cnt_server_proto : "", 22 numberOfCalls : 0, 23 wm_track_url : "", 24 wm_track_alt : "", 25 wm_cvid : 0, 26 placeOverlay : false, 27 placeHeatmap : false, 28 placeOverlayMenu : false, 29 overlayKeyLength : 32, 30 wm_page_name_value : null, 31 ovk : null, 32 overlayScriptUrl : '', 33 validateUrl : '', 34 still_alive_interval : 5000, // msecs! 35 still_alive_time_max : 30*60*1000, // msecs! 36 still_alive_time_remaining : 0, 37 still_alive_request : false, 38 use_image_container : true, 39 wm_use_ic : 0, 40 cntParamContainer: {}, 41 42 getOverlayScriptUrl : function (){ 43 var proto = wiredminds.getProtoApp(); 44 return proto+'//' + wiredminds.app_server + '/app/frontend/Ajax/overlay/OverlayManager.php?objMethod=loadScript'; 45 }, 46 47 getValidateUrl : function (){ 48 var proto = wiredminds.getProtoApp(); 49 return proto+'//' + wiredminds.app_server + '/app/frontend/Ajax/overlay/OverlayManager.php?objMethod=validateExternalKey'; 50 }, 51 52 createRandomKey : function () { 53 var keyLenght = 16; 54 var now = new Date(); 55 var outputStr = ''; 56 var inputNum = now.getTime(); 57 inputNum = inputNum.toString(); 58 var newInputNum = 0; 59 var conStr = ''; 60 var partition = 3; 61 62 while (outputStr.length < keyLenght) { 63 // Add random value 64 if (inputNum.length==0) { 65 do { 66 newInputNum = Math.round(Math.random()*123); 67 } while (newInputNum<48 || newInputNum>57 && newInputNum<65 || newInputNum>80 && newInputNum<97 || newInputNum>122); 68 inputNum = newInputNum.toString(); 69 } 70 // Separate numbers out of string 71 partition = 3; 72 do { 73 conStr = parseInt(inputNum.substr(0, partition)); 74 partition--; 75 } while ((conStr<48 || conStr>57 && conStr<65 || conStr>80 && conStr<97 || conStr>122) && partition>0); 76 inputNum = inputNum.substr(partition+1); 77 // Convert and add new character 78 if (conStr<48 || conStr>57 && conStr<65 || conStr>80 && conStr<97 || conStr>122) { 79 outputStr += conStr.toString(); 80 } else { 81 outputStr += String.fromCharCode(conStr); 82 } 83 } 84 if (outputStr.length > keyLenght) { 85 outputStr = outputStr.substr(0, keyLenght); 86 } 87 return outputStr; 88 }, 89 90 get_GET_value:function ( get_param_name ) { 91 if (!window) {return '';} 92 if (!window.location) {return '';} 93 if (!window.location.search) {return '';} 94 var search=window.location.search.substr(1); 95 var assignments=search.split('&'); 96 for( var i=0; i<assignments.length; i++ ) { 97 var assignment_splitted=assignments[i].split('='); 98 var param_name=assignment_splitted[0]; 99 var param_value=assignment_splitted[1]; 100 if (param_name == get_param_name) { 101 return decodeURIComponent(param_value); 102 } 103 } 104 return ''; 105 }, 106 107 get_HASH_value:function (hashName){ 108 109 var hashValue = null; 110 if (self.document.location){ 111 hashValue = unescape(self.document.location.hash.substring(1)); 112 } 113 if ((hashValue != null) && (hashValue != '')){ 114 var parts = hashValue.split('='); 115 if (parts.length == 2){ 116 if ((typeof(hashName) != 'undefined') && (parts[0] == hashName)){ 117 hashValue = parts[1]; 118 } 119 } 120 } 121 return hashValue; 122 }, 123 124 add_to_list : function( key, value) { 125 wiredminds.getlist += '&' + key + '=' + encodeURIComponent(value); 126 }, 127 128 //Get protocol, returns protocol string 129 getProto : function () { 130 var proto = 'http:'; 131 if ( typeof (document.location) != 'undefined') { 132 if ( typeof (document.location.protocol) != 'undefined') { 133 if ( document.location.protocol != 'file:') { 134 proto = document.location.protocol; 135 } 136 } 137 } 138 return proto; 139 }, 140 141 // get protocol for app server 142 getProtoApp : function () { 143 if (wiredminds.app_server_proto != ""){ 144 return wiredminds.app_server_proto + ':'; 145 }else{ 146 return this.getProto(); 147 } 148 }, 149 150 // get protocol for couning server 151 getProtoCnt : function () { 152 if (wiredminds.cnt_server_proto != ""){ 153 return wiredminds.cnt_server_proto + ':'; 154 }else{ 155 return this.getProto(); 156 } 157 }, 158 159 // set protocol for app server 160 setProtoApp : function (p){ 161 if (wiredminds.checkProto(p) == true){ 162 wiredminds.app_server_proto = p; 163 } 164 }, 165 166 // get protocol for couning server 167 setProtoCnt : function (p){ 168 if (wiredminds.checkProto(p) == true){ 169 wiredminds.cnt_server_proto = p; 170 } 171 }, 172 173 // check protocol for legal values 174 checkProto : function (p){ 175 var legalProtocols = new Array('http', 'https'); 176 for (var i in legalProtocols){ 177 if (p == legalProtocols[i]){ 178 return true; 179 } 180 } 181 return false;
182 }, 183 184 count_URL : function (getlist) { 185 var proto = wiredminds.getProtoCnt(); 186 var WMCT_URL=proto+'//'+this.cnt_server+'/track/ctin.php?'+getlist; 187 188 //Check if it is the first time the pixel is called (numberOfCalls==0) 189 //if it is the first then write pixel, this is required to show the webcounter on the website 190 if ( (wiredminds.numberOfCalls > 0) || wiredminds.use_image_container ) { 191 var CT_container=new Image(); 192 CT_container.src=WMCT_URL; 193 } else { 194 //NOTE: Important to first insert the node before assigning innerHTML, because IE(6) would count twice otherwise! 195 var ndDiv=document.createElement('div'); 196 var bodyEl = document.getElementsByTagName('body')[0]; 197 ndDiv = bodyEl.insertBefore(ndDiv, bodyEl.firstChild); 198 ndDiv.innerHTML='<a target="_blank" href="' + wiredminds.wm_track_url + '"><img src="' + WMCT_URL + '" alt="' + wiredminds.wm_track_alt + '" border="0" /></a>'; 199 } 200 wiredminds.numberOfCalls++; 201 }, 202 203 countpix : function (pixcode) { 204 wiredminds.setTrackParam('wm_pixelcode', pixcode); 205 wiredminds.count(); 206 }, 207 208 count_flash : function (flashArgs) { 209 if ( typeof(flashArgs) != 'string') { 210 return; 211 } 212 if ( flashArgs == '') { 213 return; 214 } 215 216 if ( flashArgs.substr(0,1) == '&') { 217 flashArgs='t2=1'+flashArgs; 218 } 219 220 wiredminds.count_URL(flashArgs); 221 }, 222 223 getPageName : function (ext){ 224 225 // auto-detect page name, if necessary 226 if (wiredminds.getTrackParam('wm_page_name') === null) { 227 //Decode to make sure it does not get double encoded 228 var wm_page_name_value = decodeURIComponent(document.location.pathname); 229 // replace '/' with '|' 230 wm_page_name_value = wm_page_name_value.replace(/^\/*/, ''); 231 wm_page_name_value = wm_page_name_value.replace(/\/*$/, ''); 232 wm_page_name_value = wm_page_name_value.replace(/\//g, '|'); 233 } else { 234 var wm_page_name_value = wiredminds.getTrackParam('wm_page_name'); 235 } 236 if (typeof(ext) == 'string') { 237 wm_page_name_value+='|'+ext; 238 } 239 240 return wm_page_name_value; 241 }, 242 243 internalCount : function (ext) { 244 //If wm_use_ic is greater than 0, it was set and ic should be stored 245 if ((wiredminds.getInternParam("wm_use_ic") > 0)) { 246 //So first check if the IC snippet was included 247 try { 248 if ((typeof ic_options !== 'undefined')) { 249 if ((typeof ic !== 'undefined') && (typeof ic.pagetrackId !== 'undefined')) { 250 //IC snippet is loaded and got a visitor id, so store it to defined indiv param 251 var icParamVal = ic.clientInfo.company.name+'#user:'+ic.gUsers[ic.activeUserId].login; 252 wiredminds.setIndivParam('wm_visit_'+wiredminds.getInternParam("wm_use_ic"), icParamVal); 253 } else { 254 //Wait a while for IC snippet 255 if (isNaN(ic_options.wired_minds_count)) { 256 ic_options.wired_minds_count = 0; 257 } 258 ic_options.wired_minds_count++; 259 // We give IC 1000ms to load 260 if (ic_options.wired_minds_count <= 5) { 261 setTimeout(function() { wiredminds.internalCount(ext); }, 200); 262 return; 263 } 264 } 265 } 266 } catch (e) { 267 //Ignore and go on 268 } 269 } 270 271 var myDate = new Date(); 272 wiredminds.getlist="t="+myDate.getTime(); // Clear/Initialize the get list. 273 // NOTE: Clearing the getlist is a must! 274 // Otherwise subsequent calls to count 275 // (e.g. by using onClick="") would 276 // append their values to the old get list. 277 278 // First the required parameters 279 if ( wiredminds.getTrackParam('wm_custnum') !== null) { 280 wiredminds.add_to_list('custnum',wiredminds.getTrackParam('wm_custnum')); 281 } else { 282 return; // no customer number given, do nothing 283 } 284 285 286 // auto-detect sname, if necessary 287 if ( wiredminds.getTrackParam('wm_sname') === null ) { 288 wiredminds.setTrackParam('wm_sname', document.location.hostname); 289 } 290 wiredminds.add_to_list('sname',wiredminds.getTrackParam('wm_sname')); 291 292 wiredminds.add_to_list('pagename',this.getPageName(ext)); 293 294 // auto-detect group name, if necessary 295 // only auto-detect if no group AND page name was explicitly set, 296 // if a page name was set, the group name will be derrived from it in the ctin.php 297 if ((wiredminds.getTrackParam('wm_group_name') === null) && (wiredminds.getTrackParam('wm_page_name') === null)) { 298 //Decode to make sure it does not get double encoded 299 wiredminds.setTrackParam('wm_group_name', decodeURIComponent(document.location.pathname.substring(0,document.location.pathname.lastIndexOf('/')))); 300 } 301 if (wiredminds.getTrackParam('wm_group_name') !== null) { 302 wiredminds.add_to_list('group', wiredminds.getTrackParam('wm_group_name')); 303 } 304 305 if ( this.still_alive_request == true) { 306 wiredminds.add_to_list('still_alive',1); 307 } 308 309 // Then the optional parameters 310 // Note: The optional parameters first get collected and added
311 // afterwards to the getlist to better control their order. 312 if (wiredminds.getTrackParam('wm_version') === null) { 313 wiredminds.setTrackParam('wm_version', '$Rev: 7840 $'); 314 } 315 if (wiredminds.getTrackParam('wm_resolution') === null) { 316 wiredminds.setTrackParam('wm_resolution', screen.width + "x" + screen.height); 317 } 318 if (wiredminds.getTrackParam('wm_color_depth') === null) { 319 var wm_color_depth = navigator.appName != 'Netscape' ? screen.colorDepth : screen.pixelDepth; 320 wiredminds.setTrackParam('wm_color_depth', wm_color_depth); 321 } 322 323 if (wiredminds.getTrackParam('wm_plugin_list') === null) { 324 var wm_plugin_list = ""; 325 for( var i=0; i<navigator.plugins.length; i++ ) { 326 wm_plugin_list += navigator.plugins[i].name + ';'; 327 } 328 wiredminds.setTrackParam('wm_plugin_list', wm_plugin_list); 329 } 330 331 if (wiredminds.getTrackParam('wm_jv') === null) { 332 var wm_jv = 0; 333 if (navigator.javaEnabled()) { 334 wm_jv=1; 335 } 336 wiredminds.setTrackParam('wm_jv', wm_jv); 337 } 338 339 if (wiredminds.getTrackParam('wm_js') === null) { 340 wiredminds.setTrackParam('wm_js', 1); 341 } 342 343 // auto-detect referrer, if necessary 344 if ( wiredminds.getTrackParam('wm_ref') === null ) { 345 if ( wiredminds.getTrackParam('wm_referrer') === null ) { 346 try { 347 if( typeof( top.document ) == "object" ) { 348 var wm_referrer_value = top.document.referrer; 349 } 350 } catch (e) { 351 var wm_referrer_value = document.referrer; 352 } 353 } else { 354 var wm_referrer_value = wiredminds.getTrackParam('wm_referrer'); 355 } 356 } else { 357 var wm_referrer_value = wiredminds.getTrackParam('wm_ref'); 358 } 359 360 if (wiredminds.getTrackParam('wm_campaign') !== null) { 361 var wm_camp_value = wiredminds.getTrackParam('wm_campaign'); 362 } else if (wiredminds.getTrackParam('wm_campaign_key') !== null) { 363 var wm_camp_value = wiredminds.get_GET_value(wiredminds.getTrackParam('wm_campaign_key')); 364 } 365 366 //Call Center 367 if (wiredminds.getTrackParam('wm_useccapplet') !== null) { 368 if (wiredminds.getTrackParam('wm_useccapplet') == 1) { 369 var wm_cvid = wiredminds.createRandomKey(); 370 wiredminds.setTrackParam('wm_cvid', wm_cvid); 371 wiredminds.setInternParam('wm_cvid', wm_cvid); 372 } 373 } 374 //END Call Center 375 376 if (wiredminds.getTrackParam('wm_version') !== null) {wiredminds.add_to_list('version',wiredminds.getTrackParam('wm_version'));} 377 if (wiredminds.getTrackParam('wm_js') !== null) {wiredminds.add_to_list('js',wiredminds.getTrackParam('wm_js'));} 378 if (wiredminds.getTrackParam('wm_jv') !== null) {wiredminds.add_to_list('jv',wiredminds.getTrackParam('wm_jv'));} 379 if (wiredminds.getTrackParam('wm_resolution') !== null) {wiredminds.add_to_list('resolution',wiredminds.getTrackParam('wm_resolution'));} 380 if (wiredminds.getTrackParam('wm_color_depth') !== null) {wiredminds.add_to_list('color_depth',wiredminds.getTrackParam('wm_color_depth'));} 381 if (wiredminds.getInternParam('numberOfCalls') == 0) { 382 //Only request webcounter if it is the first call (performance issues) 383 if (wiredminds.getTrackParam('wm_wc') !== null) {wiredminds.add_to_list('wc',wiredminds.getTrackParam('wm_wc'));} 384 } 385 if ( typeof (wm_camp_value) != 'undefined') {wiredminds.add_to_list('campaign',wm_camp_value);} 386 if (wiredminds.getTrackParam('wm_milestone') !== null) {wiredminds.add_to_list('milestone',wiredminds.getTrackParam('wm_milestone'));} 387 if (wiredminds.getTrackParam('wm_sales') !== null) {wiredminds.add_to_list('sales',wiredminds.getTrackParam('wm_sales'));} 388 if (wiredminds.getTrackParam('wm_order_id') !== null) {wiredminds.add_to_list('order_id',wiredminds.getTrackParam('wm_order_id'));} 389 if (wiredminds.getTrackParam('wm_basket') !== null) {wiredminds.add_to_list('basket',wiredminds.getTrackParam('wm_basket'));} 390 if (wiredminds.getTrackParam('wm_connspeed') !== null) {wiredminds.add_to_list('speed',wiredminds.getTrackParam('wm_connspeed'));} 391 if (wiredminds.getTrackParam('wm_txid') !== null) {wiredminds.add_to_list('txid',
391wiredminds.getTrackParam('wm_txid'));} 392 if (wiredminds.getTrackParam('wm_pixelcode') !== null) {wiredminds.add_to_list('pixel',wiredminds.getTrackParam('wm_pixelcode'));} 393 if ( typeof (wm_referrer_value) != 'undefined') {wiredminds.add_to_list('referrer',wm_referrer_value);} 394 if (wiredminds.getTrackParam('wm_ivw') !== null) {wiredminds.add_to_list('ivw',wiredminds.getTrackParam('wm_ivw'));} 395 if (wiredminds.getTrackParam('wm_ab_data') !== null) {wiredminds.add_to_list('ab_data',wiredminds.getTrackParam('wm_ab_data'));} 396 if (wiredminds.getTrackParam('wm_ud1') !== null) {wiredminds.add_to_list('ud1',wiredminds.getTrackParam('wm_ud1'));} 397 if (wiredminds.getTrackParam('wm_ud2') !== null) {wiredminds.add_to_list('ud2',wiredminds.getTrackParam('wm_ud2'));} 398 if (wiredminds.getTrackParam('wm_cd1') !== null) {wiredminds.add_to_list('cd1',wiredminds.getTrackParam('wm_cd1'));} 399 if (wiredminds.getTrackParam('wm_cvid') !== null) {wiredminds.add_to_list('cvid',wiredminds.getTrackParam('wm_cvid'));} 400 if (wiredminds.getTrackParam('wm_score') !== null) {wiredminds.add_to_list('score',wiredminds.getTrackParam('wm_score'));} 401 if (wiredminds.getTrackParam('wm_no_pi') !== null) {wiredminds.add_to_list('wm_no_pi',wiredminds.getTrackParam('wm_no_pi'));} 402 if (wiredminds.getTrackParam('wm_flver') !== null) {wiredminds.add_to_list('wm_flver',wiredminds.getTrackParam('wm_flver'));} 403 // ecommerce tracking 404 if (wiredminds.getTrackParam('wm_ec_action') !== null) {wiredminds.add_to_list('wm_ec_action',wiredminds.getTrackParam('wm_ec_action'));} 405 if (wiredminds.getTrackParam('wm_ec_basket_id') !== null) {wiredminds.add_to_list('wm_ec_basket_id',wiredminds.getTrackParam('wm_ec_basket_id'));} 406 if (wiredminds.getTrackParam('wm_ec_product_id') !== null) {wiredminds.add_to_list('wm_ec_product_id',wiredminds.getTrackParam('wm_ec_product_id'));} 407 if (wiredminds.getTrackParam('wm_ec_product_name') !== null) {wiredminds.add_to_list('wm_ec_product_name',wiredminds.getTrackParam('wm_ec_product_name'));} 408 if (wiredminds.getTrackParam('wm_ec_category_name') !== null) {wiredminds.add_to_list('wm_ec_category_name',wiredminds.getTrackParam('wm_ec_category_name'));} 409 if (wiredminds.getTrackParam('wm_ec_order_id') !== null) {wiredminds.add_to_list('wm_ec_order_id',wiredminds.getTrackParam('wm_ec_order_id'));} 410 if (wiredminds.getTrackParam('wm_ec_customer_id') !== null) {wiredminds.add_to_list('wm_ec_customer_id',wiredminds.getTrackParam('wm_ec_customer_id'));} 411 if (wiredminds.getTrackParam('wm_ec_currency') !== null) {wiredminds.add_to_list('wm_ec_currency',wiredminds.getTrackParam('wm_ec_currency'));} 412 if (wiredminds.getTrackParam('wm_ec_unit_price') !== null) {wiredminds.add_to_list('wm_ec_unit_price',wiredminds.getTrackParam('wm_ec_unit_price'));} 413 if (wiredminds.getTrackParam('wm_ec_unit_price_in_currency') !== null) {wiredminds.add_to_list('wm_ec_unit_price_in_currency',wiredminds.getTrackParam('wm_ec_unit_price_in_currency'));} 414 if (wiredminds.getTrackParam('wm_ec_total_price') !== null) {wiredminds.add_to_list('wm_ec_total_price',wiredminds.getTrackParam('wm_ec_total_price'));} 415 if (wiredminds.getTrackParam('wm_ec_total_price_in_currency') !== null) {wiredminds.add_to_list('wm_ec_total_price_in_currency',wiredminds.getTrackParam('wm_ec_total_price_in_currency'));} 416 if (wiredminds.getTrackParam('wm_ec_quantity') !== null) {wiredminds.add_to_list('wm_ec_quantity',wiredminds.getTrackParam('wm_ec_quantity'));} 417 if (wiredminds.getTrackParam('wm_ec_basket_special') !== null) {wiredminds.add_to_list('wm_ec_basket_special',wiredminds.getTrackParam('wm_ec_basket_special'));} 418 if (wiredminds.getTrackParam('wm_ec_product_special') !== null) {wiredminds.add_to_list('wm_ec_product_special',wiredminds.getTrackParam('wm_ec_product_special'));} 419 if (wiredminds.getTrackParam('wm_ec_payment_method') !== null) {wiredminds.add_to_list('wm_ec_payment_method',wiredminds.getTrackParam('wm_ec_payment_method'));} 420 421 // check for individual parameters 422 var wm_indiv_stats = wiredminds.getTrackParam('wm_indiv_stats'); 423 for (var key in wm_indiv_stats) { 424 if (wm_indiv_stats[key]){ 425 wiredminds.add_to_list(key, wm_indiv_stats[key]); 426 } 427 } 428 429 // Page Url - put it at the (near) end, because it may overflow the GET list. 430 if (wiredminds.getTrackParam('wm_page_url') !== null) { 431 wiredminds.add_to_list('page_url', encodeURIComponent(wiredminds.getTrackParam('wm_page_url'))); 432 } else { 433 wiredminds.add_to_list('page_url', encodeURIComponent(document.location)); 434 } 435 436 // The plugin list always goes last, because it can become very long and is not that required. 437 if (wiredminds.getTrackParam('wm_plugin_list') !== null) {wiredminds.add_to_list('plugins',wiredminds.getTrackParam('wm_plugin_list'));} 438 439 // end individual parameters 440 wiredminds.count_URL(wiredminds.getlist); 441 }, 442 443 ReadCookie : function (name) { 444 var nameEQ = name + "="; 445 var ca = document.cookie.split(';'); 446 for(var i=0;i < ca.length;i++) { 447 var c = ca[i]; 448 while (c.charAt(0)==' ') { 449 c = c.substring(1,c.length); 450 } 451 if (c.indexOf(nameEQ) == 0) { 452 return c.substring(nameEQ.length,c.length); 453 } 454 } 455 return null; 456 }, 457 458 SetCookie : function (name,value,nHours, path) { 459 var today = new Date(); 460 var expire = new Date(); 461 var pathStr = "/"; 462 if (nHours==null || nHours==0) { 463 nHours=1; 464 } 465 if ((typeof(path) != 'undefined') && (path != null)) { 466 pathStr = path; 467 } 468 expire.setTime(today.getTime() + 3600000 * nHours); 469 document.cookie = name+"="+escape(value) + ";expires="+expire.toGMTString() + ";path=" + pathStr; 470 471 }, 472 473 eraseCookie : function(name) {
474 this.SetCookie(name,"",-1); 475 }, 476 477 loadExternalScript : function (id, url){ 478 var oScript = document.createElement('script'); 479 oScript.id = id; 480 oScript.type = "text/javascript"; 481 oScript.src = url; 482 document.getElementsByTagName("head")[0].appendChild(oScript); 483 }, 484 485 setOverlayCookies : function(){ 486 wiredminds.eraseCookie('WMOverlayMenu'); 487 wiredminds.eraseCookie('WMOverlayKey'); 488 wiredminds.SetCookie('WMOverlayMenu', '1', 24); 489 wiredminds.SetCookie('WMOverlayKey', wiredminds.ovk, 24); 490 491 if (this.checkOverlayCookies()){ 492 this.startOverlay(); 493 } 494 }, 495 496 checkOverlayCookies : function(){ 497 wiredminds.placeOverlay = (wiredminds.ReadCookie('WMOverlay') == '1') ? true : false; 498 wiredminds.placeHeatmap = (wiredminds.ReadCookie('WMHeatmap') == '1') ? true : false; 499 wiredminds.placeOverlayMenu = (wiredminds.ReadCookie('WMOverlayMenu') == '1') ? true : false; 500 501 if (wiredminds.placeOverlayMenu || wiredminds.placeOverlay || wiredminds.placeHeatmap) { 502 return true; 503 } 504 return false; 505 }, 506 507 // load the extra javascripts for the overlay/heatmap 508 startOverlay : function(){ 509 if (this.checkOverlayCookies()){ 510 this.overlayScriptUrl = wiredminds.getOverlayScriptUrl(); 511 this.overlayScriptUrl += '&key=' + wiredminds.ovk; 512 setTimeout("wiredminds.loadExternalScript('wmOverlay','" + this.overlayScriptUrl + "')", 1000); 513 } 514 }, 515 516 doCountWiredminds : function( ext ){ 517 if (wiredminds.getTrackParam('wm_track_url') !== null) { 518 wiredminds.setInternParam('wm_track_url', wiredminds.getTrackParam('wm_track_url')); 519 } else { 520 var proto = wiredminds.getProto(); 521 wiredminds.setInternParam('wm_track_url', proto+'//'+this.www_server); 522 } 523 524 if (wiredminds.getTrackParam('wm_track_alt') !== null) { 525 wiredminds.setInternParam('wm_track_alt', wiredminds.getTrackParam('wm_track_alt')); 526 } else { 527 wiredminds.setInternParam('wm_track_alt', ''); 528 } 529 wiredminds.internalCount( ext ); 530 }, 531 532 // for Wiredminds 533 count : function ( ext ) { 534 535 var getKey = wiredminds.get_HASH_value('WMOverlayKey'); 536 537 if (getKey.length == wiredminds.overlayKeyLength){ 538 wiredminds.ovk = getKey; 539 }else{ 540 wiredminds.ovk = wiredminds.ReadCookie('WMOverlayKey'); 541 } 542 if ((wiredminds.ovk) && (wiredminds.ovk.length == wiredminds.overlayKeyLength)){ 543 // - if the key was passed and it has a length of 'overlayKeyLength' chars, it might be valid. 544 // - check the key in the backend 545 // - if the key is valid. it will automatically call the functions to load the extra javascript, 546 // and show the overlay menu. 547 wiredminds.validateUrl = wiredminds.getValidateUrl(); 548 wiredminds.validateUrl += '&key=' + wiredminds.ovk; 549 this.loadExternalScript('wmOverlayKeyValidation', wiredminds.validateUrl); 550 } else { 551 wiredminds.eraseCookie('WMOverlayKey'); 552 this.doCountWiredminds( ext ); 553 } 554 }, 555 556 // for backwards compatibility 557 counter : function ( ext ) { 558 wiredminds.count(ext); 559 }, 560 561 getVisitorLink : function () { 562 var destinationDomain = '//'+this.app_server; 563 var wm_custnum = wiredminds.getTrackParam('wm_custnum'); 564 var relPath = '/app/ct/index.php?mode=last_visitors_detail&websitesel='+wm_custnum+'&cvid='+wiredminds.wm_cvid; 565 var proto = wiredminds.getProto(); 566 var url = proto + destinationDomain + relPath; 567 return url; 568 }, 569 570 setVisitorLink : function (flashObjectId) { 571 var visitor_link = wiredminds.getVisitorLink(); 572 eval("document."+flashObjectId+".SetVariable('wm_visitor_link', visitor_link)"); 573 }, 574 575 setICForIndivVisitStat : function (indivStatId) { 576 wiredminds.setInternParam('wm_use_ic', indivStatId); 577 }, 578 579 sendStillAlive : function() { 580 if(this.placeOverlayMenu == false){ 581 this.still_alive_request=true; 582 wiredminds.internalCount(); 583 this.still_alive_request=false; // Immediatly remove it, so onClicks are counted correctly, for example! 584 585 this.still_alive_time_remaining -= this.still_alive_interval; 586 if (this.still_alive_time_remaining > 0) { 587 setTimeout("wiredminds.sendStillAlive()", this.still_alive_interval); 588 } 589 } 590 }, 591 592 activateStillAlive : function() { 593 if(this.placeOverlayMenu == false){ 594 this.still_alive_time_remaining=this.still_alive_time_max; 595 setTimeout("wiredminds.sendStillAlive()", this.still_alive_interval); 596 } 597 }, 598 599 /** 600 * Event Tracking 601 * @param string eventStr 602 */ 603 trackEvent: function(eventStr){ 604 if(this.placeOverlayMenu == false){ 605 if ((typeof(eventStr) == 'undefined') && (eventStr != '')){ 606 return; // no event string given, do nothing 607 } 608 609 var myDate = new Date(); 610 wiredminds.getlist = "t="+myDate.getTime(); // Clear/Initialize the get list. 611 // NOTE: Clearing the getlist is a must! 612 // Otherwise subsequent calls to count 613 // (e.g. by using onClick="") would 614 // append their values to the old get list. 615 // First the required parameters 616 if (wiredminds.getTrackParam('wm_custnum') !== null) { 617 wiredminds.add_to_list('custnum',wiredminds.getTrackParam('wm_custnum')); 618 } else { 619 return; // no customer number given, do nothing 620 } 621 622 wiredminds.add_to_list('wm_event', eventStr); 623 wiredminds.count_URL(wiredminds.getlist); 624 } 625 }, 626 /** 627 * Sets param into the cntParamContainer dataset used for tracking. 628 * 629 * @param string paramName The paramName to set 630 * @param mixed paramValue The paramValue to set 631 * @return void 632 */ 633 setTrackParam: function(paramName, paramValue) { 634 wiredminds['cntParamContainer'][paramName] = paramValue; 635 }, 636 /** 637 * Gets param from the cntParamContainer dataset used for tracking. 638 * 639 * @param string paramName The paramName to get 640 * @return mixed 641 */ 642 getTrackParam: function(paramName) { 643 //First check if the param is set internally 644 if (typeof wiredminds['cntParamContainer'][paramName] != 'undefined') { 645 return wiredminds['cntParamContainer'][paramName]; 646 } 647 //To be backwards compatible, also check for global variable 648 if (typeof window[paramName] != 'undefined') { 649 return window[paramName]; 650 } 651 652 return null; 653 }, 654 /** 655 * Sets internal params directly in the wiredminds object. 656 * 657 * @param string paramName The paramName to set 658 * @param mixed paramValue The paramValue to set 659 * @return void 660 */ 661 setInternParam: function(paramName, paramValue) { 662 wiredminds[paramName] = paramValue; 663 }, 664 /** 665 * Gets internal params directly from the wiredminds object. 666 * 667 * @param string paramName The paramName to get 668 * @return mixed 669 */ 670 getInternParam: function(paramName) { 671 if (typeof wiredminds[paramName] != 'undefined') { 672 return wiredminds[paramName]; 673 } 674 return null; 675 }, 676 /** 677 * Sets the given param for the indiv stats. 678 * 679 * @param string paramName The paramName to set 680 * @param mixed paramValue The paramValue to set 681 * @return void 682 */ 683 setIndivParam: function(paramName, paramValue) { 684 //Create object if it does not yet exist 685 if (typeof wiredminds['cntParamContainer']['wm_indiv_stats'] != 'object') { 686 wiredminds['cntParamContainer']['wm_indiv_stats'] = new Object(); // object to add the individual parameters 687 } 688 wiredminds['cntParamContainer']['wm_indiv_stats'][paramName] = paramValue; 689 }, 690 /** 691 * Gets the given param from the indiv stats. 692 * 693 * @param string paramName The paramName to get 694 * @return mixed 695 */ 696 getIndivParam: function(paramName) { 697 //First check if the param is set internally 698 if ((typeof wiredminds['cntParamContainer']['wm_indiv_stats'] == 'object') 699 && (typeof wiredminds['cntParamContainer']['wm_indiv_stats'][paramName] != 'undefined')) { 700 return wiredminds['cntParamContainer']['wm_indiv_stats'][paramName]; 701 } 702 //To be backwards compatible, also check for global variable 703 if ((typeof window['wm_indiv_stats'] != 'undefined') && (typeof window['wm_indiv_stats'][paramName] != 'undefined')) { 704 return window['wm_indiv_stats'][paramName]; 705 } 706 707 return null; 708 }, 709 /** 710 * Mimics Array.push function, but instead of adding the given arguments to an array, 711 * it checks if a function for value at pos 0 exists and if so, it calls it and 712 * applies the other elements as arguments to it. 713 * NOTE: Expects an array to be given, other data types will be ignored. 714 * Example: push(['functionName', param1, param2]) 715 * 716 * @return integer 717 */ 718 push: function() { 719 var called = 0; 720 var args = arguments; 721 if (args.length > 0) { 722 for (var i=0; i<args.length; i++) { 723 try { 724 //We check against given value, we expect it to be an array 725 if (typeof args[i].push=="function" && args[i].constructor==Array) { 726 if (typeof wiredminds[args[i][0]] === 'function') { 727 var result = wiredminds[args[i][0]].apply(wiredminds, args[i].slice(1)); 728 called++; 729 } 730 } 731 } catch (e) { 732 //Ignore 733 } 734 } 735 } 736 return called; 737 }, 738 /**** START HEATMAP PART ****/ 739 lastClickTime: 0, 740 cnt_path: '/track/countxy.php', 741 /** 742 * Get the click. 743 * 744 */ 745 getClick: function(e) { 746 747 var click_x = 0; 748 var click_y = 0; 749 var max_allowed_x = 2500; 750 751 //Check if a cusnum is set 752 if (wiredminds.getTrackParam('wm_custnum') === null) { 753 return; // no customer number given, do nothing 754 } 755 756 // Check if last click was at least 1 second ago 757 var time = new Date(); 758 if ((time.getTime() - wiredminds.lastClickTime) < 1000){ 759 return; 760 } 761 wiredminds.lastClickTime = time.getTime(); 762 763 /** 764 * Check if the heatmap is started 765 * If the overlay is still set, then the overlay is active, so there is no need to count the click. 766 * No need to validate the key, the counting pixel already did, and invalid keys are not stored. 767 */ 768 var overlayKey = wiredminds.ReadCookie('WMOverlayKey'); 769 if ((overlayKey) && (overlayKey.length == wiredminds.overlayKeyLength)){ 770 return; 771 } 772 773 // Grab coordinate x,y of clicks 774 var browser = wiredminds.getBrowser(); 775 if (browser.search(/IE/) != -1) { 776 click_x = event.clientX; 777 click_y = event.clientY; 778 } else { 779 click_x = e.clientX; 780 click_y = e.clientY; 781 } 782 783 var scrollbarWidth = wiredminds.getScrollbarWidth(); 784 var d = document.documentElement != undefined && document.documentElement.clientHeight != 0 ? document.documentElement : document.body; 785 var scrollx = window.pageXOffset == undefined ? d.scrollLeft : window.pageXOffset; 786 var scrolly = window.pageYOffset == undefined ? d.scrollTop : window.pageYOffset; 787 var client_w = window.innerWidth == undefined ? d.clientWidth : window.innerWidth;
788 var client_h = window.innerHeight == undefined ? d.clientHeight : window.innerHeight; 789 var body_w = d.offsetWidth; 790 var body_h = d.offsetHeight; 791 792 // Check if clicks was on the scrollbars 793 if ((body_h > client_h) && (click_x > (client_w - scrollbarWidth))) { 794 return; 795 } 796 797 // Add the width/height of scroll to coordinate 798 click_x = click_x + scrollx; 799 click_y = click_y + scrolly; 800 801 /** 802 * If wm_content_width provided content is centered, we need to calculate the mouse position relative to content width. 803 * Else content is left aligned, no need to modify mouse position. 804 */ 805 var click_x_orig = click_x; 806 var wm_content_width = wiredminds.getTrackParam('wm_content_width'); 807 if (wm_content_width !== null){ 808 wm_content_width = parseInt(wm_content_width); 809 if (!isNaN(wm_content_width) && (wm_content_width <= body_w)){ 810 click_x = (click_x - (body_w - wm_content_width)/2 ); 811 } 812 } 813 814 var page_name = wiredminds.getPageName(); 815 var params = new Array( 816 'custnum=' + wiredminds.getTrackParam('wm_custnum'), 817 'pagename=' + encodeURIComponent(page_name), 818 'cx=' + Math.round(click_x), 819 'cy=' + Math.round(click_y), 820 'body_height=' + Math.round(body_h), 821 'browser=' + browser 822 ); 823 824 if (wm_content_width !== null){ 825 if (!isNaN(wm_content_width) && (wm_content_width > 0)){ 826 max_allowed_x = ((body_w - wm_content_width)/2) + wm_content_width; 827 params.push('content=' + parseInt(wm_content_width)); 828 } 829 } 830 // send request 831 if ((click_x > 0) && (click_x_orig < max_allowed_x)){ 832 var proto = wiredminds.getProto(); 833 var count_heat_URL = proto + '//' + wiredminds.cnt_server + wiredminds.cnt_path; 834 var heatmap_container = new Image(); 835 heatmap_container.src=count_heat_URL + '?' + params.join('&'); 836 } 837 }, 838 /** 839 * Get the width of scrollbar 840 * 841 */ 842 getScrollbarWidth: function() { 843 844 var scr = null; 845 var inn = null; 846 var wNoScroll = 0; 847 var wScroll = 0; 848 849 // Outer scrolling div 850 scr = document.createElement('div'); 851 scr.style.position = 'absolute'; 852 scr.style.top = '-1000px'; 853 scr.style.left = '-1000px'; 854 scr.style.width = '100px'; 855 scr.style.height = '50px'; 856 // Start with no scrollbar 857 scr.style.overflow = 'hidden'; 858 859 // Inner content div 860 inn = document.createElement('div'); 861 inn.style.width = '100%'; 862 inn.style.height = '200px'; 863 864 // Put the inner div in the scrolling div 865 scr.appendChild(inn); 866 // Append the scrolling div to the doc 867 document.body.appendChild(scr); 868 869 // Width of the inner div sans scrollbar 870 wNoScroll = inn.offsetWidth; 871 872 // Add the scrollbar 873 var browser = wiredminds.getBrowser(); 874 if (browser.search(/IE/) != -1) { 875 scr.style.overflow = 'scroll'; 876 } else { 877 scr.style.overflow = 'auto'; 878 } 879 // Width of the inner div width scrollbar 880 wScroll = inn.offsetWidth; 881 882 // Remove the scrolling div from the doc 883 document.body.removeChild(document.body.lastChild); 884 885 // Pixel width of the scroller 886 return (wNoScroll - wScroll); 887 }, 888 /** 889 * Register heatmaps getClick event to given event type. 890 */ 891 registerHeatmapEvent: function(eventType) { 892 var eventHandlerName = 'getClick'; 893 if (typeof wiredminds[eventHandlerName] === 'function') { 894 if (document.addEventListener) { 895 document.addEventListener(eventType, wiredminds[eventHandlerName], false); 896 } else if (document.attachEvent){ 897 var ieEventType = 'on'+eventType; 898 document.attachEvent(ieEventType, wiredminds[eventHandlerName]); 899 } 900 } 901 }, 902 903 /** 904 * Detect the browsers the clickers used to view page. 905 * TODO: Moment take care the function only 4 Browsers: IE6/IE7/IE8/IE9/FF 906 */ 907 getBrowser: function() { 908 var version = navigator.appVersion; 909 if (version.search(/MSIE 6/i) != -1) return "IE6"; 910 if (version.search(/MSIE 7/i) != -1) return "IE7"; 911 if (version.search(/MSIE 8/i) != -1) return "IE8"; 912 if (version.search(/MSIE 9/i) != -1) return "IE9"; 913 if (version.search(/MSIE/i) == -1) return "Others"; 914 } 915 /**** END HEATMAP PART ****/ 916 }; 917 return wiredminds; 918 } 919 920 /** 921 * Initializes the wiredminds object if an wiredminds array exists 922 */ 923 function initWMObj() {
924 //If it is not yet our object, but an array. Then save the array, create our object and pass the array to our push function. 925 if (typeof wiredminds != 'undefined' && typeof wiredminds.push=="function" && wiredminds.constructor==Array) { 926 var wiredmindsObj = getWiredMinds(); 927 wiredmindsObj.push.apply(wiredmindsObj, wiredminds); 928 wiredminds = wiredmindsObj; 929 } else { 930 if (typeof wiredminds == 'undefined') { 931 wiredminds = getWiredMinds(); 932 } 933 } 934 } 935 //Init the object 936 initWMObj(); 937 938})(); 939 940function click_track(ext) { 941 wiredminds.push(['count', ext]); 942} 943 944/** 945 * Catch click for Heatmap 946 * 947 */ 948var getClick = function(e){ 949 wiredminds.push(['getClick', e]); 950}
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.