1//var eventName = 'click'; 2//var el = document.querySelector('button.ctbutton'); 3//var useCapture = true; 4//el.addEventListener(eventName, PushEvent, useCapture); 5var PushEvent = false; 6var otp_source = ''; 7function PushToDataLayer(id) { 8 var EventName = $('#' + id).attr('eventname'); 9 10 var utm_source = ''; 11 var utm_medium = ''; 12 var utm_campaign = ''; 13 var Platform = getDeviceType(); 14 15 var CurrUrl = $(location).attr('href'); 16 //var otp_source = ''; 17 if (CurrUrl.toLowerCase().includes('dashboard')) { 18 otp_source = 'Dashboard'; 19 } 20 else { 21 otp_source = 'Short Form'; 22 } 23 24 var landingUrl = getCookie("web_app_landing_url"); 25 var vendor_id = getCookie("vendor_id"); 26 var vendor_name = getCookie("vendor_name"); 27 var lender_id = getCookie("lender_id"); 28 var lender_name = getCookie("lender_name"); 29 30 var flow = ''; 31 32 if (vendor_id != null && vendor_id.length > 0) { 33 flow = 'vendor'; 34 } 35 else if (lender_id != null && lender_id.length > 0) { 36 flow = 'lender'; 37 } 38 else { 39 flow = 'Generic'; 40 } 41 42 var product = 'PL'; 43 const UrlPath = window.location.pathname; 44 if (UrlPath.toLowerCase().includes("small-amount-personal-loan") || UrlPath.toLowerCase().includes("newsmall-amount-personal-loan") || UrlPath.toLowerCase().includes("stplincomedetailsshortform") || UrlPath.toLowerCase().includes("stplbasicdetailsshortformsubmit")) { 45 product = 'STPL'; 46 } 47 48 var Login_Source = ''; 49 50 if (EventName === 'Existinguser_Login') { 51 if (CurrUrl.toLowerCase().includes('dashboard')) { 52 Login_Source = 'Dashboard'; 53 } 54 else { 55 Login_Source = 'Short Form'; 56 } 57 } 58 else { 59 Login_Source = null; 60 } 61 62 if (landingUrl != null && landingUrl.length > 0) { 63 var QIndex = landingUrl.indexOf('?'); 64 var QString = landingUrl.substring(QIndex + 1); 65 var arrQString = QString.split('&'); 66 for (var i = 0; i < arrQString.length; i++) { 67 if (arrQString[i].toLocaleLowerCase().includes('utm_source')) { 68 utm_source = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 69 } 70 else if (arrQString[i].toLocaleLowerCase().includes('utm_medium')) { 71 utm_medium = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 72 } 73 else if (arrQString[i].toLocaleLowerCase().includes('utm_campaign')) { 74 utm_campaign = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 75 } 76 } 77 } 78 if (!(utm_source != null && utm_source.length > 0)) { 79 utm_source = 'Organic'; 80 } 81 if (!(utm_medium != null && utm_medium.length > 0)) { 82 utm_medium = 'Organic'; 83 } 84 if (!(utm_campaign != null && utm_campaign.length > 0)) { 85 utm_campaign = 'Organic'; 86 } 87 88 var extraEvent = ''; 89 var gtmattr = $('#' + id).attr('gtmattr'); 90 if (gtmattr != null && gtmattr.length > 0) { 91 var arrGtmAttr = gtmattr.split(','); 92 for (var i = 0; i < arrGtmAttr.length; i++) { 93 if (arrGtmAttr[i].toLowerCase() == 'OTP_Source'.toLowerCase()) { 94 if (extraEvent.length == 0) { 95 extraEvent = '"' + arrGtmAttr[i] + '":"' + otp_source + '"'; 96 } 97 else { 98 extraEvent = extraEvent + ',"' + arrGtmAttr[i] + '":"' + otp_source + '"'; 99 } 100 } 101 } 102 } 103 104 105 var EventProp = '"event": "' + EventName + '","Vendor_ID":"' + vendor_id + '","Vendor_Name":"' + vend
105or_name + '","Lender_ID":"' + lender_id; 106 EventProp = EventProp + '","Lender_Name": "' + lender_name + '","Lead_Acquisition_Source":"' + utm_source; 107 EventProp = EventProp + '","Flow": "' + flow + '", "Campaign_Medium":"' + utm_medium + '","Campaign_Name": "' + utm_campaign + '","Product": "' + product + '","Platform": "' + Platform + '","Login_Source": "' + Login_Source + '"'; 108 109 if (extraEvent != null && extraEvent.length > 0) { 110 EventProp = EventProp + ',' + extraEvent; 111 } 112 EventProp = "{" + EventProp + "}"; 113 114 var obj = $.parseJSON(EventProp); 115 116 obj = clean(obj); //clear the null and empty attribute 117 118 window.dataLayer.push( 119 obj 120 ); 121 PushCleverEvent(EventName, obj); 122 //window.dataLayer.push({ 123 // 'event': EventName, 124 // 'Vendor_ID': vendor_id, 125 // 'Vendor_Name': vendor_name, 126 // 'Lender_ID': lender_id, 127 // 'Lender_Name': lender_name, 128 // 'Lead_Acqusition_Source': utm_source, 129 // 'Flow': flow, 130 // 'Campaign_Medium': utm_medium, 131 // 'Campaign_Name': utm_campaign, 132 // 'Product': product 133 134 //}); 135 PushEvent = false; 136} 137$(document).on('click', '.ctbutton', function () { 138 139 var id = $(this).attr('id'); 140 var intervalId; 141 intervalId = setInterval(function () { 142 if (PushEvent) { 143 PushToDataLayer(id); 144 clearInterval(intervalId); 145 } 146 }, 1000); 147}); 148function getCookie(name) { var match = document.cookie.match(RegExp('(?:^|;\\s*)' + name + '=([^;]*)')); return match ? match[1] : null; } 149 150 151//function GetGUserId() { 152// var GuserID = ''; 153// $.ajax({
154// method: "POST", 155// url: siteRoot + "/GetGUserID", 156// data: null, 157// async: false, 158// success: function (x) { 159// GuserID = x; 160// } 161// }); 162// return GuserID; 163//} 164//$('.ctbutton').click(function(){ 165// if ($(this).attr('EventName') != null) { 166// var eventName = 'submit'; 167// var useCapture = true; 168 169// $(this).addEventListener(eventName, PushEvent, useCapture); 170// } 171//}); 172 173 174 175// (function() { 176 177 178 179// // Attach listener directly to element or document if element not found 180// var el = document.querySelector('img#download') || document; 181 182// // Leave useCapture to true if you want to avoid propagation issues. 183// var useCapture = true; 184 185// el.addEventListener(eventName, PushEvent, useCapture); 186//})(); 187 188//function PushEvent() { 189// alert($('#' + event.target.id).attr('eventname')); 190// return function (event) { 191// if ($('#' + event.target.id).attr('eventname') != null) { 192// window.dataLayer.push({ 193// event: 'custom.event.' + event.type, 194// 'custom.gtm.element': event.target, 195// 'custom.gtm.elementClasses': event.target.className || '', 196// 'custom.gtm.elementId': event.target.id || '', 197// 'custom.gtm.elementTarget': event.target.target || '', 198// 'custom.gtm.elementUrl': event.target.href || event.target.action || '', 199// 'custom.gtm.originalEvent': event 200// }); 201// } 202// }; 203// } 204 205 206function PushCTClickEvent(obj) { 207 var id = $(obj).attr('id'); 208 var result = id.replace(/ /g, "_"); 209 var evtName = result + "_clicked"; 210 $.ajax({
211 method: "post", 212 url: siteRoot + "/hitctevent", 213 data: { EventName: evtName }, 214 success: function (x) { 215 216 } 217 }); 218} 219 220function PushCTEvent(evtName, status) { 221 222 //$.ajax({ 223 // method: "post", 224 // url: siteRoot + "/hitctevent", 225 // data: { EventName: evtName, CTStatus: status }, 226 // success: function (x) { 227 228 229 230 // } 231 //}); 232} 233function GetEventProp(EventName, extraProperties) { 234 var utm_source = ''; 235 var utm_medium = ''; 236 var utm_campaign = ''; 237 var Platform = getDeviceType(); 238 var activeTab = ''; 239 var activeSection = ''; 240 var CurrUrl = $(location).attr('href'); 241 242 if (CurrUrl.toLowerCase().includes('dashboard')) { 243 otp_source = 'Dashboard'; 244 } 245 else { 246 otp_source = 'Short Form'; 247 } 248 249 var landingUrl = getCookie("web_app_landing_url"); 250 var vendor_id = getCookie("vendor_id"); 251 var vendor_name = getCookie("vendor_name"); 252 var lender_id = getCookie("lender_id"); 253 var lender_name = getCookie("lender_name"); 254 255 var flow = ''; 256 257 if (vendor_id != null && vendor_id.length > 0) { 258 flow = 'vendor'; 259 } 260 else if (lender_id != null && lender_id.length > 0) { 261 flow = 'lender'; 262 } 263 else { 264 flow = 'Generic'; 265 } 266 267 var product = 'PL'; 268 const UrlPath = window.location.pathname; 269 if (UrlPath.toLowerCase().includes("small-amount-personal-loan") || UrlPath.toLowerCase().includes("newsmall-amount-personal-loan") || UrlPath.toLowerCase().includes("stplincomedetailsshortform") || UrlPath.toLowerCase().includes("stplbasicdetailsshortformsubmit")) { 270 product = 'STPL'; 271 } 272 273 var Login_Source = ''; 274 275 if (CurrUrl.toLowerCase().includes('dashboard')) { 276 Login_Source = 'Dashboard'; 277 } 278 else { 279 Login_Source = 'Short Form'; 280 } 281 282 if (landingUrl != null && landingUrl.length > 0) { 283 var QIndex = landingUrl.indexOf('?'); 284 var QString = landingUrl.substring(QIndex + 1); 285 var arrQString = QString.split('&'); 286 for (var i = 0; i < arrQString.length; i++) { 287 if (arrQString[i].toLocaleLowerCase().includes('utm_source')) { 288 utm_source = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 289 } 290 else if (arrQString[i].toLocaleLowerCase().includes('utm_medium')) { 291 utm_medium = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 292 } 293 else if (arrQString[i].toLocaleLowerCase().includes('utm_campaign')) { 294 utm_campaign = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 295 } 296 } 297 } 298 if (!(utm_source != null && utm_source.length > 0)) { 299 utm_source = 'Organic'; 300 } 301 if (!(utm_medium != null && utm_medium.length > 0)) { 302 utm_medium = 'Organic'; 303 } 304 if (!(utm_campaign != null && utm_campaign.length > 0)) { 305 utm_campaign = 'Organic'; 306 } 307 308 if (EventName === "PL_BasicDetail_Submitted") { 309 EventName = null; 310 } 311 312 if (EventName === "Existinguser_Login") { 313 EventName = null; 314 } 315 316 if (EventName === "PL_ApplyNow_Clicked") { 317 EventName = null; 318 } 319 320 if (EventName === "OTP_Submitted") { 321 EventName = null; 322 } 323 if (EventName === "CR_CheckReport_Clicked" || EventName === "CR_Shortform_Submitted") { 324 EventName = null; 325 Login_Source = null; 326 product = null; 327 flow = null; 328 utm_source = "Direct"; 329 } 330 if (EventName === 'PL_Offer_Applied' || EventName === 'PL_Offer_Continued') { 331 var dashboardCategory = document.querySelector('.dashboard-category'); 332 333 // Check if the <ul> element exists 334 if (dashboardCategory) { 335 var activeTabs = dashboardCategory.querySelectorAll('.active'); 336 337 338 if (activeTabs.length > 0) { 339 activeTabs.forEach(tab => { 340 341 var activeTabLink = tab.querySelector('a'); 342 if (activeTabLink) { 343 activeTab = activeTabLink.textContent; 344 } 345 }); 346 } 347 } 348 var allsectionsactive = document.querySelector('.nav-tabs .nav-link.active'); 349 if (allsectionsactive) { 350 351 var activeSectionId = allsectionsactive ? allsectionsactive.id : null; 352 353 activeSection = allsectionsactive ? allsectionsactive.getAttribute('href').substring(1) : null; 354 } 355 } 356 if (EventName === 'Dashboard_CR_Repull' || EventName === 'CR_EntrypointFromTracker' || EventName === 'PLEntrypointFromTracker') { 357 var dashboardCategory = document.querySelector('.dashboard-category'); 358 359 // Check if the <ul> element exists 360 if (dashboardCategory) { 361 var activeTabs = dashboardCategory.querySelectorAll('.active'); 362 363 364 if (activeTabs.length > 0) {
365 activeTabs.forEach(tab => { 366 367 var activeTabLink = tab.querySelector('a'); 368 if (activeTabLink) { 369 activeTab = activeTabLink.textContent; 370 } 371 }); 372 } 373 } 374 375 } 376 var EventProp = '"event": "' + EventName + '","Vendor_ID":"' + vendor_id + '","Vendor_Name":"' + vendor_name + '","Lender_ID":"' + lender_id; 377 EventProp = EventProp + '","Lender_Name": "' + lender_name + '","Lead_Acquisition_Source":"' + utm_source; 378 EventProp = EventProp + '","ActiveTab": "' + activeTab; 379 EventProp = EventProp + '","ActiveSection": "' + activeSection; 380 EventProp = EventProp + '","Flow": "' + flow + '", "Campaign_Medium":"' + utm_medium + '","Campaign_Name": "' + utm_campaign + '","Product": "' + product + '","Login_Source": "' + Login_Source + '","Platform": "' + Platform + '"'; 381 // Include additional properties if provided 382 if (extraProperties && typeof extraProperties === 'object') { 383 for (var key in extraProperties) { 384 if (extraProperties.hasOwnProperty(key)) { 385 EventProp = EventProp + ',"' + key + '":"' + extraProperties[key] + '"'; 386 } 387 } 388 } 389 return EventProp; 390} 391 392function GetEventPropV1(EventName, TypeFlag) { 393 var utm_source = ''; 394 var utm_medium = ''; 395 var utm_campaign = ''; 396 var Platform = getDeviceType(); 397 398 var CurrUrl = $(location).attr('href'); 399 400 if (CurrUrl.toLowerCase().includes('dashboard')) { 401 otp_source = 'Dashboard'; 402 } 403 else { 404 otp_source = 'Short Form'; 405 } 406 407 var landingUrl = getCookie("web_app_landing_url"); 408 var vendor_id = getCookie("vendor_id"); 409 var vendor_name = getCookie("vendor_name"); 410 var lender_id = getCookie("lender_id"); 411 var lender_name = getCookie("lender_name"); 412 413 var flow = ''; 414 415 if (vendor_id != null && vendor_id.length > 0) { 416 flow = 'vendor'; 417 } 418 else if (lender_id != null && lender_id.length > 0) { 419 flow = 'lender'; 420 } 421 else { 422 flow = 'Generic'; 423 } 424 425 var product = 'PL'; 426 const UrlPath = window.location.pathname; 427 if (UrlPath.toLowerCase().includes("small-amount-personal-loan") || UrlPath.toLowerCase().includes("newsmall-amount-personal-loan") || UrlPath.toLowerCase().includes("stplincomedetailsshortform") || UrlPath.toLowerCase().includes("stplbasicdetailsshortformsubmit")) { 428 product = 'STPL'; 429 } 430 431 var Login_Source = ''; 432 433 if (CurrUrl.toLowerCase().includes('dashboard')) { 434 Login_Source = 'Dashboard'; 435 } 436 else { 437 Login_Source = 'Short Form'; 438 } 439 440 if (landingUrl != null && landingUrl.length > 0) { 441 var QIndex = landingUrl.indexOf('?'); 442 var QString = landingUrl.substring(QIndex + 1); 443 var arrQString = QString.split('&'); 444 for (var i = 0; i < arrQString.length; i++) { 445 if (arrQString[i].toLocaleLowerCase().includes('utm_source')) { 446 utm_source = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 447 } 448 else if (arrQString[i].toLocaleLowerCase().includes('utm_medium')) { 449 utm_medium = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 450 } 451 else if (arrQString[i].toLocaleLowerCase().includes('utm_campaign')) { 452 utm_campaign = arrQString[i].split('=').length > 1 ? arrQString[i].split('=')[1] : ''; 453 } 454 } 455 } 456 if (!(utm_source != null && utm_source.length > 0)) { 457 utm_source = 'Organic'; 458 } 459 if (!(utm_medium != null && utm_medium.length > 0)) { 460 utm_medium = 'Organic'; 461 } 462 if (!(utm_campaign != null && utm_campaign.length > 0)) { 463 utm_campaign = 'Organic'; 464 } 465 466 if (TypeFlag === "1") { 467 EventName = null; 468 flow = null; 469 lender_id = null; 470 lender_name = null; 471 vendor_id = null; 472 vendor_name = null; 473 Login_Source = null; 474 product = null; 475 } 476 477 if (TypeFlag === "2") { 478 EventName = null; 479 } 480 481 if (TypeFlag === "3") { 482 EventName = null; 483 } 484 485 if (TypeFlag === "6") { 486 EventName = null; 487 Login_Source = null; 488 } 489 if (TypeFlag === "7") { 490 EventName = null; 491 Login_Source = null; 492 product = "CR"; 493 flow = null; 494 utm_source = "Direct"; 495 } 496 var EventProp = '"event": "' + EventName + '","Vendor_ID":"' + vend
496or_id + '","Vendor_Name":"' + vendor_name + '","Lender_ID":"' + lender_id; 497 EventProp = EventProp + '","Lender_Name": "' + lender_name + '","Lead_Acquisition_Source":"' + utm_source; 498 EventProp = EventProp + '","Flow": "' + flow + '", "Campaign_Medium":"' + utm_medium + '","Campaign_Name": "' + utm_campaign + '","Product": "' + product + '","Login_Source": "' + Login_Source + '","Platform": "' + Platform + '"'; 499 500 return EventProp; 501} 502 503function PushEventFromSDK(EventName, extraProperties = {}) { 504 505 var EventProp = GetEventProp(EventName, extraProperties); 506 EventProp = "{" + EventProp + "}"; 507 508 var obj = $.parseJSON(EventProp); 509 510 obj = clean(obj); //clear the null and empty attribute 511 512 window.dataLayer.push( 513 obj 514 ); 515 PushCleverEvent(EventName, obj); 516} 517 518function PushEventFromSDKV1(EventName, TypeFlag) { 519 520 var EventProp = GetEventPropV1(EventName, TypeFlag); 521 EventProp = "{" + EventProp + "}"; 522 523 var obj = $.parseJSON(EventProp); 524 525 obj = clean(obj); //clear the null and empty attribute 526 527 window.dataLayer.push( 528 obj 529 ); 530 PushCleverEvent(EventName, obj); 531} 532 533function PushCleverEvent(EventName, EventProp) { 534 //var url = window.location.href; 535 //var isUat = url?.toLowerCase().includes('uat'); 536 //if (isUat) { 537 // var gUserId = getCookie("g_user_id"); 538 // if (gUserId != '' && gUserId != undefined && gUserId != null) { 539 // console.log('CTIdSet'); 540 // clevertap.profile.push({ "Site": { "Identity": gUserId, } }, function (err, response) { 541 // console.log('CleverTap response:', response); 542 // if (err) { console.error('CleverTap error:', err); } 543 // }); 544 545 // } 546 //} 547 //clevertap.event.push(EventName, EventProp 548 //); 549} 550 551 552function clean(obj) { 553 for (var propName in obj) { 554 if (obj[propName] === null || obj[propName] === undefined || obj[propName] === '' || obj[propName].toLowerCase() === "null") { 555 delete obj[propName]; 556 } 557 } 558 return obj; 559} 560function getDeviceType() { 561 const userAgent = navigator.userAgent; 562 const maxTouchPoints = navigator.maxTouchPoints || 0; 563 564 if (/Mobi|Android|iPhone|Mobile/i.test(userAgent)) { 565 return "MWeb"; 566 } 567 568 if (/Tablet|iPad|PlayBook/i.test(userAgent) || (maxTouchPoints > 1 && /Macintosh/i.test(userAgent))) { 569 return "MWeb"; 570 } 571 572 return "Web"; 573} 574 575function getInitials(t) { if (!t) return ""; let e = t.trim().split(/\s+/); return (e[0] ? e[0][0].toUpperCase() : "") + (e.length > 1 ? e[e.length - 1][0].toUpperCase() : "") } function setInitials() { let t = $("#ReEnteredName").val(); t && "" != t && "" != t || (t = $("#li_display_name").val()); let e = getInitials(t); e && ($("#profileIcon .un").text(e), $("#login-dropdown .un").text(e)) } $(document).ready((function () { setInitials() })); 576 577$(document).ready(function () { 578 LAMFNavbarClickEvent(); 579}); 580function LAMFNavbarClickEvent() { 581 var PersonalLoanBaseurlVal = document.getElementById('PersonalLoanBaseurl').value; 582 var PerosnalLoanredirect = document.getElementById('lamf-page-web'); 583 if (PerosnalLoanredirect) { 584 PerosnalLoanredirect.addEventListener('click', function (e) { 585 e.preventDefault(); 586 if (typeof PushCleverEvent === 'function') { PushCleverEvent('LAMF_Entrypoint_Clicked', { Section: 'Navbar', Platform: getDeviceType() }); } 587 window.location.href = PersonalLoanBaseurlVal + '/Loan-Against-Mutual-Funds'; 588 }); 589 } 590 var PLhomepageredirect = document.getElementById('lamf-page-Mweb'); 591 if (PLhomepageredirect) { 592 PLhomepageredirect.addEventListener('click', function (e) { 593 e.preventDefault(); 594 if (typeof PushCleverEvent === 'function') { PushCleverEvent('LAMF_Entrypoint_Clicked', { Section: 'Navbar', Platform: getDeviceType() }); } 595 window.location.href = PersonalLoanBaseurlVal + '/Loan-Against-Mutual-Funds'; 596 }); 597 } 598}
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.