1//please take note that this file duplicated in website 2var Website; 3(function (Website) { 4 var FirstClickTracking = /** @class */ (function () { 5 // WS-5467 : Website Interaction Tracking :: END 6 function FirstClickTracking() { 7 this.cookieName = "ufcv5"; 8 this.cookieNameo1 = "ufcn"; 9 this.cookieNameo = "ufc"; 10 // WS-5467 : Website Interaction Tracking :: Start 11 this.localStorageTotalInteraction = "totalmarketinginteractions"; 12 this.localStorageNameInteractions = "Interactions"; 13 this.localStorageLast_utm_medium = "Last_utm_medium"; 14 this._cookieUtils = new Website.CookiesManager(); 15 this.init(); 16 } 17 FirstClickTracking.prototype.init = function () { 18 var self = this; 19 console.log("cookies firstclicktracking.ts remove all key"); 20 self._cookieUtils.remove(self.cookieNameo); //delete old cookie 21 self._cookieUtils.remove(self.cookieNameo1); //delete old cookie 22 console.log("cookies firstclicktracking.ts remove all key successfully"); 23 //Need to refresh cookie while utm medium is affilaite 24 var queryString = self.getUrlParameter('utm_medium'); 25 if (queryString != undefined) { 26 if (queryString.toString().toLowerCase() == 'affiliate') { 27 self._cookieUtils.remove(self.cookieName); //delete old cookie 28 } 29 } 30 var cookieValue = self._cookieUtils.get(self.cookieName); 31 if (cookieValue === null || cookieValue === "") { 32 self.getSourceTypeRequest(); 33 } 34 //WS - 5467 : Website Interaction Tracking :: start 35 var currentUrl = document.location.href; 36 //console.log("currentUrl", currentUrl); 37 self.setLocalStorageByMedium(currentUrl); 38 //WS - 5467 : Website Interaction Tracking :: End 39 }; 40 FirstClickTracking.prototype.getUrlParameter = function (sParam) { 41 var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; 42 for (i = 0; i < sURLVariables.length; i++) { 43 sParameterName = sURLVariables[i].split('='); 44 if (sParameterName[0] === sParam) { 45 return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 46 } 47 } 48 }; 49 FirstClickTracking.prototype.setCookie = function (key, value) { 50 if (document.cookie.indexOf(key) <= 0) { 51 var expiryDate = new Date(); 52 expiryDate.setMonth(expiryDate.getMonth() + 1); //1 month 53 console.log("cookies set firstclickTracking.ts key: " + key); 54 this._cookieUtils.set(key, value, { path: '/', expires: new Date(expiryDate), secure: true }); 55 console.log("cookies set firstclickTracking.ts key: " + key + " successfully"); 56 //let cookieString = key + "=" + value + "; path=/; expires=" + expiryDate.toUTCString() + "; secure: true; "; 57 //document.cookie = cookieString; 58 } 59 }; 60 //getCookie(name) { 61 // var value = "; " + document.cookie; 62 // var parts = value.split("; " + name + "="); 63 // if (parts.length == 2) return parts.pop().split(";").shift(); 64 // return ""; 65 //} 66 //private deleteCookie(key: string): void { 67 // document.cookie = key + "=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC"; 68 //} 69 FirstClickTracking.prototype.checkHostname = function () { 70 if (document.referrer === "") 71 return true; 72 if (document.referrer.split("/")[2] !== window.location.hostname) //proceed when only referrer's hostname different with website's hostname 73 return true; 74 return false; 75 }; 76 FirstClickTracking.prototype.isLocalStorageAvailable = function () { 77 try { 78 window.localStorage.length; 79 return true; 80 } 81 catch (e) { 82 return false; 83 } 84 }; 85 FirstClickTracking.prototype.getSourceTypeRequest = function () { 86 var self = this; 87 $.ajax({
88 type: "GET", 89 data: { urlReferrer: document.referrer, currentUrl: window.location.href }, 90 url: "/estore/api/FirstClick/GetFirstClickType", 91 success: function (data) { 92 if (data !== null) { 93 self.setCookie(self.cookieName, data); 94 } 95 }, 96 error: function (e) { 97 console.log(e.statusText); 98 } 99 }); 100 }; 101 //WS - 5467 : Website Interaction Tracking 102 FirstClickTracking.prototype.getUrlUtmParameter = function () { 103 var objSearchParam = {}; 104 var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; 105 for (i = 0; i < sURLVariables.length; i++) { 106 sParameterName = sURLVariables[i].split('='); 107 objSearchParam[sParameterName[0]] = sParameterName[1]; 108 } 109 // WS-5573 : Improvements for Website Interactions 110 // WS - 5583 : Interaction time will be consider in UTC instead of GMT 111 objSearchParam["timestamp"] = new Date().toISOString(); // Display timestamp in utc 112 //console.log(" getUrlUtmParameter : ", objSearchParam); 113 return objSearchParam; 114 }; 115 FirstClickTracking.prototype.getUrlUtmParameterByKey = function (sParamkey) { 116 var objSearchParam = {}; 117 var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; 118 for (i = 0; i < sURLVariables.length; i++) { 119 sParameterName = sURLVariables[i].split('='); 120 if (sParameterName[0] == sParamkey) { 121 return objSearchParam[sParameterName[0]] = sParameterName[1]; 122 } 123 } 124 }; 125 // WS-5525 : Need to track Direct and Refferrer interactions without UTM info as well 126 FirstClickTracking.prototype.getParameterwithoutUTM = function (jsonData) { 127 var objSearchParam = {}; 128 var withoutUTMParameter = JSON.parse(jsonData); 129 // WS-5573 : Improvements for Website Interactions 130 // WS - 5582 : Ignore interactions for PayPal(Direct and Express) 131 if (withoutUTMParameter.Source != null && withoutUTMParameter.Source != undefined && withoutUTMParameter.Source.toString().toLowerCase().includes("paypal.com")) { 132 return; 133 } 134 // WS - 5598 : Improvements for Website Interactions Part - 2 135 if (withoutUTMParameter.Source != null && withoutUTMParameter.Source != undefined && withoutUTMParameter.Source.toString().toLowerCase().includes("identity.contrado")) { 136 return; 137 } 138 objSearchParam["source"] = withoutUTMParameter.Source; 139 objSearchParam["medium"] = withoutUTMParameter.Medium; 140 objSearchParam["campaign"] = withoutUTMParameter.Campaign; 141 objSearchParam["term"] = withoutUTMParameter.Term; 142 objSearchParam["referrer"] = withoutUTMParameter.Referrer; 143 // WS-5573 : Improvements for Website Interactions 144 // WS - 5583 : Interaction time will be consider in UTC instead of GMT 145 objSearchParam["timestamp"] = new Date().toISOString(); // Display timestamp in utc 146 return objSearchParam; 147 }; 148 FirstClickTracking.prototype.setLocalStorageByMedium = function (currentUrl) { 149 //console.log("setLocalStorageByMedium"); 150 var objSearchParam = this.getUrlUtmParameter(); 151 // WS-5573 : Improvements for Website Interactions 152 if (this.getUrlUtmParameterByKey('utm_nooverride') != null && this.getUrlUtmParameterByKey('utm_nooverride') != undefined && this.getUrlUtmParameterByKey('utm_nooverride') == 1) { 153 return; 154 } 155 if (currentUrl.includes("utm_medium")) { 156 //console.log("utm_medium"); 157 var param_utm_medium = ""; 158 var param_utm_campaign = ""; 159 if (this.getUrlUtmParameterByKey('utm_medium') != null && this.getUrlUtmParameterByKey('utm_medium') != undefined) { 160 param_utm_medium = this.getUrlUtmParameterByKey('utm_medium').toString(); 161 } 162 if (this.getUrlUtmParameterByKey('utm_campaign') != null && this.getUrlUtmParameterByKey('utm_campaign') != undefined) { 163 param_utm_campaign = this.getUrlUtmParameterByKey('utm_campaign').toString(); 164 } 165 var utmMediumUniqueId = param_utm_medium + "###" + param_utm_campaign;
166 // WS - 5525 : Need to track Direct and Refferrer interactions without UTM info as well 167 this.SetLocalStorageWithUTMMedium(utmMediumUniqueId, objSearchParam, param_utm_medium, param_utm_campaign); 168 } 169 // WS - 5525 : Need to track Direct and Refferrer interactions without UTM info as well 170 else { 171 this.getSourceTypeRequestWithoutUTM(); 172 } 173 }; 174 FirstClickTracking.prototype.SetLocalStorageWithUTMMedium = function (utmMediumUniqueId, objSearchParam, param_utm_medium, param_utm_campaign) { 175 if (this.isLocalStorageAvailable()) { 176 try { 177 var localStorageutm_medium = localStorage.getItem(this.localStorageTotalInteraction); 178 if (localStorageutm_medium == null || localStorageutm_medium == undefined) { 179 //Storage Last Medium :: Start 180 var objLastutmMedium = { 181 utm_medium: utmMediumUniqueId 182 }; 183 localStorage.setItem(this.localStorageLast_utm_medium, JSON.stringify(objLastutmMedium)); 184 //Storage Last Medium :: Start 185 //Total Interaction localStorage :: Start 186 var marketinginteractions = { 187 TotalInteractionCount: 1 188 }; 189 localStorage.setItem(this.localStorageTotalInteraction, JSON.stringify(marketinginteractions)); 190 //Total Interaction localStorage :: End 191 //Medium wise local storage :: start 192 if (this.interActionArray == null && this.interActionArray == undefined) 193 this.interActionArray = []; 194 var mediumWiseParameter = { 195 InteractionCount: 1, 196 InteractionInfo: JSON.stringify(objSearchParam) 197 }; 198 this.interActionArray.push(mediumWiseParameter); 199 this.setLocalStorageValueAtServerSide(this.localStorageNameInteractions, JSON.stringify(this.interActionArray)); 200 //Medium wise local storage :: END 201 } 202 else { 203 this.checkUTMMediumInLocalStorage(param_utm_medium, param_utm_campaign, objSearchParam); 204 } 205 } 206 catch (e) { 207 console.log('Local Storage error', e); 208 } 209 } 210 }; 211 FirstClickTracking.prototype.checkUTMMediumInLocalStorage = function (param_utm_medium, param_utm_campaign, objSearchParam) { 212 var utmMediumUniqueId = param_utm_medium + "###" + param_utm_campaign; 213 if (this.isLocalStorageAvailable()) { 214 try { 215 if (localStorage.getItem(this.localStorageLast_utm_medium) != null && localStorage.getItem(this.localStorageLast_utm_medium) != undefined) { 216 if (JSON.parse(localStorage.getItem(this.localStorageLast_utm_medium)).utm_medium != utmMediumUniqueId) { 217 //Total Interaction localStorage :: Start 218 var marketinginteractionsJson = JSON.parse(localStorage.getItem(this.localStorageTotalInteraction)); 219 marketinginteractionsJson.TotalInteractionCount = marketinginteractionsJson.TotalInteractionCount + 1; 220 localStorage.setItem(this.localStorageTotalInteraction, JSON.stringify(marketinginteractionsJson)); 221 //Total Interaction localStorage :: End 222 var objLastutmMedium = { 223 utm_medium: utmMediumUniqueId 224 }; 225 localStorage.setItem(this.localStorageLast_utm_medium, JSON.stringify(objLastutmMedium)); 226 this.CheckAllInteractions(utmMediumUniqueId, objSearchParam); 227 } 228 } 229 else { 230 //Total Interaction localStorage :: Start 231 var marketinginteractionsJson = JSON.parse(localStorage.getItem(this.localStorageTotalInteraction)); 232 marketinginteractionsJson.TotalInteractionCount = marketinginteractionsJson.TotalInteractionCount + 1; 233 localStorage.setItem(this.localStorageTotalInteraction, JSON.stringify(marketinginteractionsJson)); 234 //Total Interaction localStorage :: End 235 var objLastutmMedium = { 236 utm_medium: utmMediumUniqueId 237 }; 238 localStorage.setItem(this.localStorageLast_utm_medium, JSON.stringify(objLastutmMedium)); 239 this.CheckAllInteractions(utmMediumUniqueId, objSearchParam); 240 } 241 } 242 catch (e) { 243 console.log('Local Storage error', e); 244 } 245 } 246 }; 247 FirstClickTracking.prototype.CheckAllInteractions = function (utmMediumUniqueId, objSearchParam) { 248 if (this.isLocalStorageAvailable()) { 249 try { 250 if (localStorage.getItem(this.localStorageNameInteractions) != null && localStorage.getItem(this.localStorageNameInteractions) != undefined) { 251 var findInteraction = false; 252 var mediumWiseInteractions = JSON.parse(localStorage.getItem(this.localStorageNameInteractions)); 253 for (var i = 0; i < mediumWiseInteractions.length; i++) { 254 var utmParamArray = JSON.parse(mediumWiseInteractions[i].InteractionInfo); 255 if (utmParamArray.utm_medium + "###" + utmParamArray.utm_campaign == utmMediumUniqueId) { 256 mediumWiseInteractions[i].InteractionCount = mediumWiseInteractions[i].InteractionCount + 1; 257 // WS-5573 : Improvements for Website Interactions 258 mediumWiseInteractions[i].InteractionInfo = JSON.stringify(objSearchParam); 259 findInteraction = true; 260 break; 261 } 262 } 263 if (!findInteraction) { 264 var mediumWiseParameter = { 265 InteractionCount: 1, 266 InteractionInfo: JSON.stringify(objSearchParam) 267 }; 268 mediumWiseInteractions.push(mediumWiseParameter); 269 } 270 this.setLocalStorageValueAtServerSide(this.localStorageNameInteractions, JSON.stringify(mediumWiseInteractions)); 271 } 272 else { 273 var mediumWiseParameterFirstTime = { 274 InteractionCount: 1, 275 InteractionInfo: JSON.stringify(objSearchParam) 276 }; 277 if (this.interActionArray == null || this.interActionArray == undefined) 278 this.interActionArray = []; 279 this.interActionArray.push(mediumWiseParameterFirstTime); 280 this.setLocalStorageValueAtServerSide(this.localStorageNameInteractions, JSON.stringify(this.interActionArray)); 281 } 282 } 283 catch (e) { 284 console.log('Local Storage error', e); 285 } 286 } 287 }; 288 FirstClickTracking.prototype.setLocalStorageValueAtServerSide = function (keyName, jsonValue) { 289 if (this.isLocalStorageAvailable()) { 290 try { 291 localStorage.setItem(keyName, jsonValue); 292 } 293 catch (e) { 294 console.log('Local Storage error', e); 295 } 296 } 297 this.CheckUtmContentAndMedium(); 298 }; 299 // WS-5507 : Email Clickthrough - When utm from system email is detected, record the click 300 FirstClickTracking.prototype.CheckUtmContentAndMedium = function () { 301 if (this.getUrlUtmParameterByKey('utm_medium') != null && this.getUrlUtmParameterByKey('utm_medium') != undefined) { 302 if (this.getUrlUtmParameterByKey('utm_medium').toString().toLowerCase() === "email") { 303 if (this.getUrlUtmParameterByKey('utm_content') != null && this.getUrlUtmParameterByKey('utm_content') != undefined) { 304 this.UpdateIsClickedInContradoEmailsRequest(this.getUrlUtmParameterByKey('utm_content').toString()); 305 } 306 } 307 } 308 }; 309 // WS-5507 : Email Clickthrough - When utm from system email is detected, record the click 310 FirstClickTracking.prototype.UpdateIsClickedInContradoEmailsRequest = function (emailUniqueId) { 311 var self = this; 312 $.ajax({
313 type: "GET", 314 data: { uniqueId: emailUniqueId }, 315 url: "/estore/api/contradoemail/UpdateIsClickedContradoEmails", 316 success: function (data) { 317 console.log("UpdateIsClickedInContradoEmailsRequest successfully updated"); 318 }, 319 error: function (e) { 320 console.log(e.statusText); 321 } 322 }); 323 }; 324 // WS-5525 : Need to track Direct and Refferrer interactions without UTM info as well 325 FirstClickTracking.prototype.getSourceTypeRequestWithoutUTM = function () { 326 var _this = this; 327 //console.log("getSourceTypeRequestWithoutUTM"); 328 //console.log("urlReferrer :", document.referrer); 329 //console.log("currentUrl :", window.location.href); 330 $.ajax({ 331 type: "GET", 332 data: { urlReferrer: document.referrer, currentUrl: window.location.href }, 333 url: "/estore/api/FirstClick/GetDetailsWithoutUTM", 334 success: function (data) { 335 //console.log("GetDetailsWithoutUTM : ", data) 336 if (data !== null) { 337 var objSearchParam = _this.getParameterwithoutUTM(JSON.stringify(data)); 338 //console.log("objSearchParam : ", objSearchParam) 339 if (objSearchParam != undefined && objSearchParam != null) { 340 var param_utm_medium = ""; 341 var param_utm_campaign = ""; 342 var param_utm_source = ""; 343 var param_utm_referrer = ""; 344 if (objSearchParam['medium'] != null && objSearchParam['medium'] != undefined) { 345 // WS-5573 : Improvements for Website Interactions 346 if (objSearchParam['medium'] != null && objSearchParam['medium'] != undefined) { 347 param_utm_medium = objSearchParam['medium'].toString(); 348 } 349 if (objSearchParam['campaign'] != null && objSearchParam['campaign'] != undefined) { 350 param_utm_campaign = objSearchParam['campaign'].toString(); 351 } 352 if (objSearchParam['source'] != null && objSearchParam['source'] != undefined) { 353 param_utm_source = objSearchParam['source'].toString(); 354 } 355 if (objSearchParam['referrer'] != null && objSearchParam['referrer'] != undefined) { 356 param_utm_referrer = objSearchParam['referrer'].toString(); 357 } 358 var utmMediumUniqueId = param_utm_medium + "###" + param_utm_campaign + "###" + param_utm_source; 359 // WS - 5598 : Improvements for Website Interactions Part - 2 360 //console.log("SetLocalStorageWithoutUTMMedium", utmMediumUniqueId); 361 var findDirectInteraction = _this.CheckDirectInteractions(utmMediumUniqueId, objSearchParam); 362 if (!findDirectInteraction) { 363 _this.SetLocalStorageWithoutUTMMedium(utmMediumUniqueId, objSearchParam, param_utm_source, param_utm_referrer); 364 } 365 } 366 } 367 } 368 }, 369 error: function (e) { 370 console.log("GetDetailsWithoutUTM Error : ", e.statusText); 371 } 372 }); 373 }; 374 FirstClickTracking.prototype.GetDomainNameFromURL = function () { 375 var domain = (new URL(document.location.href)); 376 return domain.hostname; 377 }; 378 FirstClickTracking.prototype.SetLocalStorageWithoutUTMMedium = function (utmMediumUniqueId, objSearchParam, param_utm_source, param_utm_referrer) { 379 var domainName = this.GetDomainNameFromURL(); 380 //console.log("domainName : ", domainName); 381 //console.log("param_utm_source : ", param_utm_source); 382 //console.log("param_utm_referrer : ", param_utm_referrer); 383 //console.log("SetLocalStorageWithoutUTMMedium-objSearchParam : ", objSearchParam); 384 if (domainName != param_utm_source) { 385 this.SetlocalStorage(utmMediumUniqueId, objSearchParam); 386 } 387 else { 388 if (param_utm_referrer != undefined && param_utm_referrer != null && param_utm_referrer != "" && param_utm_referrer.includes("/blog")) { 389 this.SetlocalStorage(utmMediumUniqueId, objSearchParam); 390 } 391 } 392 }; 393 FirstClickTracking.prototype.SetlocalStorage = function (utmMediumUniqueId, objSearchParam) { 394 if (this.isLocalStorageAvailable()) { 395 try { 396 var localStorageutm_medium = localStorage.getItem(this.localStorageTotalInteraction); 397 if (localStorageutm_medium == null || localStorageutm_medium == undefined) { 398 //Storage Last Medium :: Start 399 var objLastutmMedium = { 400 utm_medium: utmMediumUniqueId 401 }; 402 localStorage.setItem(this.localStorageLast_utm_medium, JSON.stringify(objLastutmMedium)); 403 //Storage Last Medium :: Start 404 //Total Interaction localStorage :: Start 405 var marketinginteractions = { 406 TotalInteractionCount: 1 407 }; 408 localStorage.setItem(this.localStorageTotalInteraction, JSON.stringify(marketinginteractions)); 409 //Total Interaction localStorage :: End 410 //Medium wise local storage :: start 411 if (this.interActionArray == null && this.interActionArray == undefined) 412 this.interActionArray = []; 413 var mediumWiseParameter = { 414 InteractionCount: 1, 415 InteractionInfo: JSON.stringify(objSearchParam) 416 }; 417 this.interActionArray.push(mediumWiseParameter); 418 this.setLocalStorageValueAtServerSide(this.localStorageNameInteractions, JSON.stringify(this.interActionArray)); 419 //Medium wise local storage :: END 420 } 421 else { 422 this.checkwithoutUTMMediumInLocalStorage(utmMediumUniqueId, objSearchParam); 423 } 424 } 425 catch (e) { 426 console.log('Local Storage error', e); 427 } 428 } 429 }; 430 FirstClickTracking.prototype.checkwithoutUTMMediumInLocalStorage = function (utmMediumUniqueId, objSearchParam) { 431 if (this.isLocalStorageAvailable()) { 432 try { 433 if (localStorage.getItem(this.localStorageLast_utm_medium) != null && localStorage.getItem(this.localStorageLast_utm_medium) != undefined) { 434 if (JSON.parse(localStorage.getItem(this.localStorageLast_utm_medium)).utm_medium != utmMediumUniqueId) { 435 //Total Interaction localStorage :: Start 436 var marketinginteractionsJson = JSON.parse(localStorage.getItem(this.localStorageTotalInteraction)); 437 marketinginteractionsJson.TotalInteractionCount = marketinginteractionsJson.TotalInteractionCount + 1; 438 localStorage.setItem(this.localStorageTotalInteraction, JSON.stringify(marketinginteractionsJson)); 439 //Total Interaction localStorage :: End 440 var objLastMedium = { 441 utm_medium: utmMediumUniqueId 442 }; 443 localStorage.setItem(this.localStorageLast_utm_medium, JSON.stringify(objLastMedium)); 444 this.CheckAllWithoutUtmInteractions(utmMediumUniqueId, objSearchParam); 445 } 446 } 447 else { 448 //Total Interaction localStorage :: Start 449 var marketinginteractionsJson = JSON.parse(localStorage.getItem(this.localStorageTotalInteraction)); 450 marketinginteractionsJson.TotalInteractionCount = marketinginteractionsJson.TotalInteractionCount + 1; 451 localStorage.setItem(this.localStorageTotalInteraction, JSON.stringify(marketinginteractionsJson)); 452 //Total Interaction localStorage :: End 453 var objLastMedium = { 454 utm_medium: utmMediumUniqueId 455 }; 456 localStorage.setItem(this.localStorageLast_utm_medium, JSON.stringify(objLastMedium)); 457 this.CheckAllWithoutUtmInteractions(utmMediumUniqueId, objSearchParam); 458 } 459 } 460 catch (e) { 461 console.log('Local Storage error', e); 462 } 463 } 464 }; 465 FirstClickTracking.prototype.CheckAllWithoutUtmInteractions = function (utmMediumUniqueId, objSearchParam) { 466 if (this.isLocalStorageAvailable()) { 467 try { 468 if (localStorage.getItem(this.localStorageNameInteractions) != null && localStorage.getItem(this.localStorageNameInteractions) != undefined) { 469 var findInteraction = false; 470 var mediumWiseInteractions = JSON.parse(localStorage.getItem(this.localStorageNameInteractions)); 471 for (var i = 0; i < mediumWiseInteractions.length; i++) { 472 var utmParamArray = JSON.parse(mediumWiseInteractions[i].InteractionInfo); 473 if (utmParamArray.medium + "###" + utmParamArray.campaign + "###" + utmParamArray.source == utmMediumUniqueId) { 474 mediumWiseInteractions[i].InteractionCount = mediumWiseInteractions[i].InteractionCount + 1; 475 // WS-5573 : Improvements for Website Interactions 476 mediumWiseInteractions[i].InteractionInfo = JSON.stringify(objSearchParam); 477 findInteraction = true; 478 break; 479 } 480 } 481 if (!findInteraction) { 482 var mediumWiseParameter = { 483 InteractionCount: 1, 484 InteractionInfo: JSON.stringify(objSearchParam) 485 }; 486 mediumWiseInteractions.push(mediumWiseParameter); 487 } 488 this.setLocalStorageValueAtServerSide(this.localStorageNameInteractions, JSON.stringify(mediumWiseInteractions)); 489 } 490 else { 491 var mediumWiseParameterFirstTime = { 492 InteractionCount: 1, 493 InteractionInfo: JSON.stringify(objSearchParam) 494 }; 495 if (this.interActionArray == null || this.interActionArray == undefined) 496 this.interActionArray = []; 497 this.interActionArray.push(mediumWiseParameterFirstTime); 498 this.setLocalStorageValueAtServerSide(this.localStorageNameInteractions, JSON.stringify(this.interActionArray)); 499 } 500 } 501 catch (e) { 502 console.log('Local Storage error', e); 503 } 504 } 505 }; 506 // WS-5598 : Improvements for Website Interactions Part - 2 507 FirstClickTracking.prototype.CheckDirectInteractions = function (utmMediumUniqueId, objSearchParam) { 508 var findDirectInteraction = false; 509 if (this.isLocalStorageAvailable()) { 510 try { 511 if (localStorage.getItem(this.localStorageNameInteractions) != null && localStorage.getItem(this.localStorageNameInteractions) != undefined) { 512 var mediumWiseInteractions = JSON.parse(localStorage.getItem(this.localStorageNameInteractions)); 513 for (var i = 0; i < mediumWiseInteractions.length; i++) { 514 var utmParamArray = JSON.parse(mediumWiseInteractions[i].InteractionInfo); 515 if (utmParamArray.medium + "###" + utmParamArray.campaign + "###" + utmParamArray.source == utmMediumUniqueId) { 516 if (objSearchParam.source != undefined && objSearchParam.source != null && objSearchParam.source.toString().toLowerCase() == "direct") { 517 findDirectInteraction = true; 518 break; 519 } 520 } 521 } 522 } 523 } 524 catch (e) { 525 console.log('Local Storage error', e); 526 } 527 } 528 return findDirectInteraction; 529 }; 530 return FirstClickTracking; 531 }()); 532 Website.FirstClickTracking = FirstClickTracking; 533})(Website || (Website = {})); 534$(function () { 535 var firstClickTracking = new Website.FirstClickTracking(); 536}); 537//# sourceMappingURL=FirstClickTracking.js.map
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.