1window.adobeDataLayer = window.adobeDataLayer || []; 2//Below code should be executed on page load 3var lang = $("html").attr("lang"); 4var errorlbl = ''; 5var pageid = document.querySelector('meta[name="pagetcmid"]').content.split('-')[1]; 6var frontlne = window.location.hostname.split(".").pop(); 7var initiativeid = typeof ($('.wForm form .calc-InitiativeID').attr('value')) === "undefined" ? "" : "," + $('.wForm form .calc-InitiativeID').attr('value'); 8var pagearray = {}; 9if (frontlne == "com") { 10 frontlne = "global"; 11} 12//console.log("ML1-" + $('form :input[value="ML"]').attr('id')); 13var formlead = $('form :input[value="ML"]').attr('id'); 14//console.log(formlead); 15//console.log(typeof ($('.wForm form').attr('id')) === "undefined" ? "No Array form" : "We have Array form"); 16var fulltitle = ""; 17var scid = GetParameterValues("scid"); 18if (typeof (scid) === "undefined") { 19 //no action 20} else { 21 if (scid.indexOf("@") > 0) { 22 scid = ''; 23 } 24} 25//console.log((typeof (scid) === "undefined" || scid == '') ? "No Salesforce ID" : "Scid:" + scid); 26$('.sub-module-breadcrumb div ul li,.krtemplate .module-breadcrumbs ul li').each(function () { 27 var ncount = $(this).index(); 28 if (ncount == 0) { 29 fulltitle += finaltitle($(this).text()); 30 } 31 if (ncount == 1) { 32 fulltitle += ":" + finaltitle($(this).text()); 33 } 34 if (ncount == 2) { 35 fulltitle += ":" + finaltitle($(this).text()); 36 } 37 if (ncount == 3) { 38 fulltitle += ":" + finaltitle($(this).text()); 39 } 40}) 41var titlewithcountry = document.getElementsByTagName("title")[0].innerHTML; 42const ptitle = titlewithcountry.replace("-" + titlewithcountry.split("-").pop(), ""); 43if (fulltitle.match("^:")) { 44 fulltitle = "home" + fulltitle; 45} 46var pagetitle = fulltitle == "" ? "home" : fulltitle; 47//console.log('ptitle-' + ptitle + ',pagetitle-' + pagetitle); 48if (ptitle.indexOf('404') >= 0 || ptitle.indexOf('500') >= 0) { 49 if (typeof (scid) === "undefined" || scid == '') { 50 adobeDataLayer.push({ 51 "event": "pageView", 52 "page": { 53 "pageName": pagetitle + ":" + ptitle, 54 "id": pageid, 55 "site": "kone", 56 "cluster": cluster(window.location.hostname), 57 "frontline": frontlne, 58 "language": lang, 59 "country": frontlne, 60 "pageType": "errorPage", 61 "contentType": "errorPage" 62 }, 63 "loginStatus": "logged out" 64 }) 65 } 66 else { 67 adobeDataLayer.push({ 68 "event": "pageView", 69 "page": { 70 "pageName": pagetitle + ":" + ptitle, 71 "id": pageid, 72 "site": "kone", 73 "cluster": cluster(window.location.hostname), 74 "frontline": frontlne, 75 "language": lang, 76 "country": frontlne, 77 "pageType": "errorPage", 78 "contentType": "n/a" 79 }, 80 "loginStatus": "logged out", 81 "campaigns": { 82 "salesforceId": scid, 83 "salesforceAction": "Opened Page" 84 } 85 }) 86 } 87} 88else { 89 pagearray["pageName"] = pagetitle; 90 pagearray["id"] = pageid; 91 pagearray["site"] = "kone"; 92 pagearray["cluster"] = cluster(window.location.hostname); 93 pagearray["frontline"] = frontlne; 94 pagearray["language"] = lang; 95 pagearray["country"] = frontlne; 96 pagearray["contentType"] = 'n/a'; 97 $('.sub-module-breadcrumb div ul li,.krtemplate .module-breadcrumbs ul li').each(function () { 98 var ncount = $(this).index(); 99 if (ncount == 1) { 100 pagearray["siteSection"] = finaltitle($(this).text()); 101 } 102 if (ncount == 2) { 103 pagearray["siteSubSection1"] = finaltitle($(this).text()); 104 } 105 if (ncount == 3) { 106 pagearray["siteSubSection2"] = finaltitle($(this).text()); 107 } 108 }) 109 if (pageid == 15817 || pageid == 8937 || pageid == 70123 || pageid == 52745) { 110 pagearray["siteSection"] = "home page"; 111 } 112 if (typeof ($('.wForm form').attr('id')) === "undefined" && $('#koneFeedOrderForm').length == 0) { 113 if (typeof (scid) === "undefined" || scid == '') { 114 /*Thankyou page AA datalayer Start*/ 115 var thankyouformid, thankyouinitiativeid = ""; 116 if (isThankYouPage()) { 117 console.log("This is a Thank You page."); 118 var formidParam = getQueryParam('formid'); 119 if (formidParam != null) { 120 if (formidParam) { 121 var values = formidParam ? formidParam.split(',') : []; 122 thankyouformid = values[0] || ""; // First value as formid 123 thankyouinitiativeid = values[1] || ""; // Second value as initiative 124 var thankyouFormName = values.length === 2 ? `${thankyouformid},${thankyouinitiativeid}` : thankyouformid; 125 console.log("Thank You Form ID:", thankyouformid); 126 console.log("Initiative ID:", thankyouinitiativeid); 127 adobeDataLayer.push({ 128 "event": "pageView", 129 "page": pagearray, 130 "form": { 131 "isFormComplete": true, 132 "formName": thankyouFormName, 133 "formType": thankyouformid, 134 "leadType": typeof (formlead) === "undefined" ? "sales" : "marketing" 135 } 136 }); 137 } 138 } 139 else { 140 console.log("This is a Thank You page but no formdata is passed in query params."); 141 adobeDataLayer.push({ 142 "event": "pageView", 143 "page": pagearray, 144 "loginStatus": "logged out" 145 }) 146 } 147 148 } else { 149 console.log("This is NOT a Thank You page."); 150 adobeDataLayer.push({ 151 "event": "pageView", 152 "page": pagearray, 153 "loginStatus": "logged out" 154 }) 155 } 156 /*Thankyou page AA datalayer End*/ 157 } 158 else { 159 adobeDataLayer.push({ 160 "event": "pageView", 161 "page": pagearray, 162 "loginStatus": "logged out", 163 "campaigns": { 164 "salesforceId": scid, 165 "salesforceAction": "Opened Page" 166 } 167 }) 168 } 169 } else { 170 var formid = $('.wForm form').attr('id').toLowerCase(); 171 formid = formid == 'tfa_0' ? $('#tfa_dbFormId').val() : formid; 172 var finalid = typeof (formid) === "undefined" ? $('form header h1').text().toLowerCase() : formid; 173 if (typeof (scid) === "undefined" || scid == '') { 174 if ($('.service').length > 0) { 175 adobeDataLayer.push({ 176 "event": "pageView", 177 "page": pagearray, 178 "module": { 179 "isModuleImpression": true, 180 "moduleName": "Service Lead Magnet", 181 "moduleId": finalid, 182 "moduleType": "Lead Magnet" 183 } 184 }) 185 } 186 else if ($('.maintenance').length > 0) { 187 adobeDataLayer.push({ 188 "event": "pageView", 189 "page": pagearray, 190 "module": { 191 "isModuleImpression": true, 192 "moduleName": "Maintenance Lead Magnet", 193 "moduleId": finalid, 194 "moduleType": "Lead Magnet" 195 } 196 }) 197 } 198 else { 199 adobeDataLayer.push({ 200 "event": "pageView", 201 "page": pagearray, 202 "loginStatus": "logged out", 203 "form": { 204 "isFormView": true, 205 "formName": finalid + initiativeid, 206 "formType": finalid, 207 "leadType": typeof (formlead) === "undefined" ? "sales" : "marketing" 208 } 209 }) 210 } 211 } 212 else { 213 adobeDataLayer.push({ 214 "event": "pageView", 215 "page": pagearray, 216 "loginStatus": "logged out", 217 "campaigns": { 218 "salesforceId": scid, 219 "salesforceAction": "Opened Page" 220 }, 221 "form": { 222 "isFormView": true, 223 "formName": finalid + initiativeid, 224 "formType": finalid, 225 "leadType": typeof (formlead) === "undefined" ? "sales" : "marketing" 226 } 227 }) 228 } 229 } 230} 231$(document).ready(function () { 232 233 234 //var pagetitle = finaltitle(document.getElementsByTagName("title")[0].innerHTML); 235 //Below code should be executed when user click on Social Share Icons 236 $("div.social a,a.social-icon").click(function () { 237 var getTitle = finaltitle($(this).attr("title")); 238 //console.log('Get Title-' + getTitle); 239 adobeDataLayer.push({ 240 "event": "click", 241 "social": { 242 "platform": getTitle, 243 "pageName": pagetitle 244 } 245 }) 246 });
247 $(".module-announcement-banner a").click(function () { 248 var getTitle = finaltitle($(this).text()); 249 adobeDataLayer.push({ 250 "event": "click", 251 "cta": { 252 "name": getTitle, 253 "isGenericClick": true, 254 "page": pagearray, // friendly page name 255 "placement": "Header", // example header/footer/sidebar 256 "component": "Web Ticker" //example web ticker/button/carousel 257 } 258 259 }) 260 }); 261 //Below code should be executed when user click on CTA buttons Header, Footer, Accordion, Related Tags, All Buttons, Article 262 $(".kone-language-selector-wide div div ul li a,header a, footer .menulinks a,footer .quicklinks a,.footer__bottomlinks a,.module-downloadlist ul li button, .module-downloadlist ul li a, .module-faq ul li button,.module-faq ul li a,.module-related-tags ul li a,button,.ktemplate article a, table a,.resetFilter,.content-block-item a, button span,.errorpage-searchlinks a,.module-history a,.arrow,a.btt,footer .logo a,footer .logo-tagline a,a.btn.btn-primary,.ktemplate .content a,header h2 a").click(function () { 263 var getTitle = finaltitle($(this).text()); 264 if (getTitle.length == 0) { 265 if ($(this).html().indexOf('logo') > 0) { 266 getTitle = "kone logo" 267 } 268 if ($(this).html().indexOf('search') > 0) { 269 getTitle = "search" 270 } 271 } 272 if (getTitle.length != 0) { 273 console.log('Get Title-' + getTitle + ',href-' + $(this).attr('href')); 274 if ($(this).attr('type') === "button") { 275 // no href 276 adobeDataLayer.push({ 277 "event": "click", 278 "cta": { 279 "name": getTitle, 280 "pageName": pagetitle 281 } 282 }) 283 } 284 else if (typeof ($(this).attr('href')) === "undefined") { 285 // no href 286 } 287 else { 288 if (isitfile($(this).attr('href').toLowerCase())) { 289 adobeDataLayer.push({ 290 "event": "click", 291 "download": { 292 "fileName": getTitle, 293 "gatedType": "gated", // or "non gated", 294 "contentType": "brochure" 295 } 296 }) 297 } else { 298 adobeDataLayer.push({ 299 "event": "click", 300 "cta": { 301 "name": getTitle, 302 "pageName": pagetitle 303 } 304 }) 305 306 } 307 } 308 } 309 }); 310 311 $(".krtemplate article a, .krtemplate .content a").click(function () { 312 var getTitle = ''; 313 if ($(this).find('img').length > 0) { 314 getTitle = finaltitle($(this).find('img').attr('alt')); 315 } 316 else { 317 getTitle = finaltitle($(this).text()); 318 if (getTitle.length == 0) { 319 if ($(this).find('h3').text().length > 0) { 320 getTitle = finaltitle($(this).find('h3').text()); 321 } 322 else if ($(this).find('h4').text().length > 0) { 323 getTitle = finaltitle($(this).find('h4').text()); 324 } 325 else if ($(this).attr("title").length > 0) { 326 getTitle = finaltitle($(this).attr("title")); 327 } 328 } 329 } 330 if (getTitle.length > 0) { 331 if (isitfile($(this).attr('href').toLowerCase())) { 332 adobeDataLayer.push({ 333 "event": "click", 334 "download": { 335 "fileName": getTitle, 336 "gatedType": "gated", // or "non gated", 337 "contentType": "brochure" 338 } 339 }) 340 } 341 else { 342 adobeDataLayer.push({ 343 "event": "click", 344 "cta": { 345 "name": getTitle, 346 "pageName": pagetitle 347 } 348 }) 349 } 350 } 351 });
352 //Below code should be executed when user click on Mosaic, slick carousel 353 $(".ktemplate .kone-mosaic a,.ktemplate .slick-list a,.ktemplate .module-selected-highlights a,.ktemplate ul.kone-quick-links li a, .ktemplate .module-business-line-highlight a").click(function () { 354 var getTitle = finaltitle($(this).text()); 355 if (getTitle.length == 0) { 356 getTitle = finaltitle($(this).find('h3').text()); 357 } 358 if (getTitle.length == 0) { 359 getTitle = finaltitle($(this).find('h4').text()); 360 } 361 console.log('Get Title-' + getTitle); 362 adobeDataLayer.push({ 363 "event": "click", 364 "cta": { 365 "name": getTitle, 366 "pageName": pagetitle 367 } 368 }) 369 }); 370 $(".module-tools-downloads a").click(function () { 371 var getTitle = finaltitle($(this).text()); 372 if (getTitle.length == 0) { 373 getTitle = finaltitle($(this).find('h3').text()); 374 } 375 if (getTitle.length == 0) { 376 getTitle = finaltitle($(this).find('h4').text()); 377 } 378 379 console.log('Get Title-' + getTitle); 380 if (isitfile($(this).attr('href').toLowerCase())) { 381 adobeDataLayer.push({ 382 "event": "click", 383 "download": { 384 "fileName": getTitle, 385 "gatedType": "gated", // or "non gated", 386 "contentType": "brochure" 387 } 388 }) 389 } 390 else { 391 adobeDataLayer.push({ 392 "event": "click", 393 "cta": { 394 "name": getTitle, 395 "pageName": pagetitle 396 } 397 }) 398 } 399 }); 400 $(".podcast-play-types ul li a").click(function () { 401 var getTitle = finaltitle($(this).find('p.podcast-type-title').text()); 402 console.log('Get Title-' + getTitle); 403 adobeDataLayer.push({ 404 "event": "click", 405 "cta": { 406 "name": getTitle, 407 "pageName": pagetitle 408 } 409 }) 410 }); 411 //Accordion 412 $(".module-faq ul li label, ul.kone-sitemap-accordionlist li label,ul.kone-sitemap-accordionlist li a").click(function () { 413 var getTitle = finaltitle($(this).text()); 414 console.log('Get Title-' + getTitle); 415 adobeDataLayer.push({ 416 "event": "click", 417 "accordion": { 418 "name": getTitle, 419 "pageName": pagetitle 420 } 421 }) 422 }); 423 $('select').on('change', function () { 424 var getTitle = finaltitle($(this).find(":selected").text()); 425 console.log('Get value-' + getTitle); 426 adobeDataLayer.push({ 427 "event": "change", 428 "dropdown": { 429 "name": getTitle, 430 "pageName": pagetitle 431 } 432 }) 433 }); 434 $('.module-news input:checkbox').on('change', function () { 435 var getTitle = finaltitle($(this).val()); 436 console.log('Get value-' + getTitle); 437 adobeDataLayer.push({ 438 "event": "click", 439 "checkbox": { 440 "name": getTitle, 441 "pageName": pagetitle 442 } 443 }) 444 }); 445 $('.errorpage-content .errorpage-search .errorpage-search-input button').on('click', function () { 446 console.log($('.errorpage-content .errorpage-search .errorpage-search-input input').val()); 447 448 adobeDataLayer.push({ 449 "event": "click", 450 "search": { 451 "keyword": $('.errorpage-content .errorpage-search .errorpage-search-input input').val() 452 } 453 }) 454 }); 455 $('.hero-slider .slick-arrow').on('click', function () { 456 adobeDataLayer.push({ 457 "event": "click", 458 "cta": { 459 "name": "slider arrow", 460 "pageName": pagetitle 461 } 462 }) 463 }); 464 $('.hero-slider .slick-dots li').on('click', function () { 465 adobeDataLayer.push({ 466 "event": "click", 467 "cta": { 468 "name": "slider dots", 469 "pageName": pagetitle 470 } 471 }) 472 });
473 $('section .play').on('click', function () { 474 adobeDataLayer.push({ 475 "event": "click", 476 "cta": { 477 "name": "video play", 478 "pageName": pagetitle 479 } 480 }) 481 }); 482 483 $('form').one('click', function (e) { 484 485 if ($(this).attr("action").indexOf('searchresults') < 0) { 486 if ($('.service').length == 0 && $('.maintenance').length == 0) { 487 var formid = $('.wForm form').attr('id').toLowerCase(); 488 formid = formid == 'tfa_0' ? $('#tfa_dbFormId').val() : formid; 489 var finalid = typeof (formid) === "undefined" ? $('form header h1').text().toLowerCase() : formid; 490 adobeDataLayer.push({ 491 "event": "click", 492 "form": { 493 "isFormStart": true, 494 "formName": finalid + initiativeid, 495 "formType": finalid, 496 "leadType": typeof (formlead) === "undefined" ? "sales" : "marketing" 497 } 498 }) 499 } 500 } 501 }); 502}); 503$(window).on('load', function () { 504 505 //console.log("ML2-"+$('form :input[value="ML"]').attr('id')); 506 Search(); 507 508 $('form :input[value="empty_page_id"]').val(pageid); 509 $('form :input[value="Last-Visited-Page"]').val(this.document.referrer); 510 var formcampaignData = getCampaignData(); 511 if (formcampaignData != null) { 512 $('form :input[value="empty_campaign_data"]').val(decodeURIComponent(formcampaignData)); 513 } 514 else { 515 console.log('Form campaignData is null'); 516 } 517 518 //click 519 $(".module-latest-press-releases div ul li a,.module-latest-press-releases div article a,.kone-panorama div .pnlm-load-button,.kone-panorama-slider ul li div .pnlm-load-button,.module-news div div button,.module-latest-press-releases header a.see-all-press-releases,.module-press-release-filter a,.module-press-release-index table td a").click(function () { 520 var getTitle = finaltitle($(this).text()); 521 console.log('Get Title-' + getTitle); 522 adobeDataLayer.push({ 523 "event": "click", 524 "cta": { 525 "name": getTitle, 526 "pageName": pagetitle 527 } 528 }) 529 }); 530 //Below code should be executed when user click on Mosaic, slick carousel 531 $(".module-news .slick-list section div a,.module-news div a,.module-teaser div section div a,.module-news-reference-filter .results-holder a").click(function () { 532 var getTitle = finaltitle($(this).text()); 533 if (getTitle.length == 0) { 534 getTitle = finaltitle($(this).find('h3').text()); 535 } 536 if (getTitle.length == 0) { 537 getTitle = finaltitle($(this).find('h4').text()); 538 } 539 console.log('Get Title-' + getTitle); 540 adobeDataLayer.push({ 541 "event": "click", 542 "cta": { 543 "name": getTitle, 544 "pageName": pagetitle 545 } 546 }) 547 }); 548 549 550 //Below code should be executed when user click on Mosaic, slick carousel 551 $(".module-publication-center div section div a").click(function () { 552 var getTitle = finaltitle($(this).text()); 553 if (getTitle.length == 0) { 554 getTitle = finaltitle($(this).find('h3').text()); 555 } 556 if (getTitle.length == 0) { 557 getTitle = finaltitle($(this).find('h4').text()); 558 } 559 console.log('Get Title-' + getTitle); 560 561 if (isitfile($(this).attr('href').toLowerCase())) { 562 adobeDataLayer.push({ 563 "event": "click", 564 "download": { 565 "fileName": getTitle, 566 "gatedType": "gated", // or "non gated", 567 "contentType": "brochure" 568 } 569 }) 570 } else { 571 adobeDataLayer.push({ 572 "event": "click", 573 "cta": { 574 "name": getTitle, 575 "pageName": pagetitle 576 } 577 }) 578 } 579 });
580 581 $('.carousel .slick-arrow').on('click', function () { 582 adobeDataLayer.push({ 583 "event": "click", 584 "cta": { 585 "name": "slider arrow", 586 "pageName": pagetitle 587 } 588 }) 589 }); 590 $('.carousel .slick-dots li').on('click', function () { 591 adobeDataLayer.push({ 592 "event": "click", 593 "cta": { 594 "name": "slider dots", 595 "pageName": pagetitle 596 } 597 }) 598 }); 599 $('.container .stop-video,.close-button button').on('click', function () { 600 adobeDataLayer.push({ 601 "event": "click", 602 "cta": { 603 "name": "Close", 604 "pageName": pagetitle 605 } 606 }) 607 }); 608 609 $('form input:button').on('click', function () { 610 var getTitle = finaltitle($(this).val()); 611 console.log('Get value-' + getTitle); 612 adobeDataLayer.push({ 613 "event": "click", 614 "cta": { 615 "name": getTitle, 616 "pageName": pagetitle 617 } 618 }) 619 }); 620 621 $('form input:radio').on('click', function () { 622 var getTitle = finaltitle($(this).siblings('label').text()); 623 console.log('Get value-' + getTitle); 624 adobeDataLayer.push({ 625 "event": "click", 626 "radio": { 627 "name": getTitle, 628 "pageName": pagetitle 629 } 630 }) 631 }); 632 633 if (typeof ($('.wForm form').attr('id')) !== "undefined") { 634 ServiceLeadForm(); 635 636 this.MaintenanceLeadForm(); 637 } 638}); 639 640function Search() { 641 if (window.location.href.indexOf("#stq") > -1) { 642 var scount = $('.st-search-container .st-search-summary .st-query-present strong:nth-child(3)').html(); 643 //console.log(scount + '-scount'); 644 if (typeof (scount) === "undefined") { 645 adobeDataLayer.push({ 646 "event": "click", 647 "search": { 648 "keyword": $('input[type="search"]').val(), 649 "results": 0 650 } 651 }) 652 } else { 653 //console.log($('input[type="search"]').val() + 'Search count:' + scount); 654 adobeDataLayer.push({ 655 "event": "click", 656 "search": { 657 "keyword": $('input[type="search"]').val(), 658 "results": scount 659 } 660 }) 661 } 662 } 663 $('input[type="search"]').keydown(function (e) { 664 if (e.which == 13) { 665 if (window.location.href.indexOf("#stq") > -1) { 666 setTimeout( 667 function () { 668 var scount = $('.st-search-container .st-search-summary .st-query-present strong:nth-child(3)').html(); 669 if (typeof (scount) === "undefined") { 670 scount = 0; 671 } 672 //console.log('scount on enter -' + scount); 673 adobeDataLayer.push({ 674 "event": "click", 675 "search": { 676 "keyword": $('input[type="search"]').val(), 677 "results": scount 678 } 679 }) 680 }, 681 5000); 682 } 683 } 684 }); 685 686 $("header form button").click(function () { 687 if (window.location.href.indexOf("#stq") > -1) { 688 setTimeout( 689 function () { 690 var scount = $('.st-search-container .st-search-summary .st-query-present strong:nth-child(3)').html(); 691 //console.log(scount + '-scount'); 692 if (typeof (scount) === "undefined") { 693 scount = 0; 694 } 695 //console.log('scount on button click -' + scount); 696 adobeDataLayer.push({ 697 "event": "click", 698 "search": { 699 "keyword": $('input[type="search"]').val(), 700 "results": scount 701 } 702 }) 703 }, 704 5000); 705 } 706 });
707 $(".st-search-container .st-ui-container .st-ui-container-footer_bar .st-query-present a").click(function () { 708 //console.log('pagination click:' + $(this).text()) 709 adobeDataLayer.push({ 710 "event": "click", 711 "searchPage": { 712 "number": $.trim($(this).text()) 713 } 714 }) 715 }); 716 $(".st-search-container .st-ui-container .st-ui-container-footer_bar .st-search-pagination").on('DOMSubtreeModified', function (e) { 717 $(this).find('.st-query-present a').on('click', function (e) { 718 //console.log('new pagination click:' + $(this).text()); 719 adobeDataLayer.push({ 720 "event": "click", 721 "searchPage": { 722 "number": $.trim($(this).text()) 723 } 724 }) 725 }); 726 }); 727 $("#submit_button").on('click', function () { 728 var formid = $('.wForm form').attr('id').toLowerCase(); 729 formid = formid == 'tfa_0' ? $('#tfa_dbFormId').val() : formid; 730 var finalid = typeof (formid) === "undefined" ? $('form header h1').text().toLowerCase() : formid; 731 if ($('.service').length == 0 && $('.maintenance').length == 0) { 732 var vtimeout = 200; 733 console.log('vtimeout-' + vtimeout); 734 if (($("#submit_button").is(":enabled"))) { 735 setTimeout( 736 function () { 737 var fcategory = $('.calc-category option:selected').text(); 738 if ($('.errFld').length == 0 && $('.errMsg').length == 0) { 739 adobeDataLayer.push({ 740 "event": "click", 741 "form": { 742 "isFormSubmitted": true, 743 "formName": finalid + initiativeid, 744 "formType": finalid, 745 "leadType": typeof (formlead) === "undefined" ? "sales" : "marketing", 746 "formTopic": typeof (fcategory) === "undefined" ? finalid : fcategory 747 } 748 }) 749 } 750 else { 751 $(".errFld").each(function () { 752 errorlbl += $(this).find(".reqMark").attr('id').trim() + ": Answer not selected | "; 753 }); 754 adobeDataLayer.push({ 755 "event": "click", 756 "form": { 757 "isFormError": true, 758 "formName": finalid + initiativeid, 759 "formType": finalid, 760 "leadType": typeof (formlead) === "undefined" ? "sales" : "marketing", 761 "formErrorDetails": errorlbl.trim().slice(0, -2) 762 } 763 }) 764 errorlbl = ''; 765 } 766 }, 767 vtimeout); 768 } 769 else { 770 GenerateDatalayerlog(finalid + "| Submit button not enabled!"); 771 } 772 } 773 }); 774 $(".st-search-container .st-ui-container .st-ui-container-primary_content .st-search-results .st-query-present a").click(function (e) { 775 //console.log($(this).index() + 1); 776 //console.log('link click:' + $(this).find('.st-ui-type-heading').text()) 777 adobeDataLayer.push({ 778 "event": "click", 779 "searchResult": { 780 "name": finaltitle($(this).find('.st-ui-type-heading').text()), 781 "position": $(this).index() + 1 782 } 783 }) 784 }); 785 $(".st-search-container .st-ui-container .st-ui-container-primary_content .st-search-results").on('DOMSubtreeModified', function (e) { 786 $(this).find('.st-query-present a').on('click', function (e) { 787 //console.log($(this).index() + 1); 788 //console.log('new link click:' + $(this).find('.st-ui-type-heading').text()); 789 adobeDataLayer.push({ 790 "event": "click", 791 "searchResult": { 792 "name": finaltitle($(this).find('.st-ui-type-heading').text()), 793 "position": $(this).index() + 1 794 } 795 }) 796 }); 797 });
798} 799 800function ServiceLeadForm() { 801 //Service Lead Form 802 var sformid = $('.wForm form').attr('id').toLowerCase(); 803 sformid = sformid == 'tfa_0' ? $('#tfa_dbFormId').val() : sformid; 804 var sfinalid = typeof (sformid) === "undefined" ? $('form header h1').text().toLowerCase() : sformid; 805 var lblname = "Service Lead Magnet"; 806 var lbltype = "Lead Magnet"; 807 $('.service #showform').on('click', function (e) { 808 adobeDataLayer.push({ 809 "event": "click", 810 "module": { 811 "moduleName": lblname, 812 "moduleId": sfinalid, 813 "moduleType": lbltype, 814 "moduleStepName": "Get Started", 815 "moduleStep": "step0", 816 "isModuleStart": true 817 } 818 }) 819 }); 820 821 //Below code should be executed on click of Next Button 822 //Update the step number and name accordingly until step5 823 $('.service #wfPageNextId2').on('click', function (e) { 824 if (document.querySelector('input[name="tfa_153"]:checked') !== null) { 825 adobeDataLayer.push({ 826 "event": "click", 827 "module": { 828 "moduleName": lblname, 829 "moduleId": sfinalid, 830 "moduleType": lbltype, 831 "moduleStep": "step1", 832 "moduleStepName": "step1", 833 "moduleQuestion": $('#tfa_152 div label.preField').attr("id"), 834 "optionSelected": document.querySelector('input[name="tfa_153"]:checked').labels[0].id 835 } 836 }); 837 } 838 else { 839 $(".wfCurrentPage .errFld").each(function () { 840 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 841 }); 842 adobeDataLayer.push({ 843 "event": "click", 844 "module": { 845 "moduleName": lblname, 846 "moduleId": sfinalid, 847 "moduleType": lbltype, 848 "moduleStep": "step1", 849 "moduleStepName": "step1", 850 "moduleQuestion": $('#tfa_152 div label.preField').attr("id"), 851 "optionSelected": "", 852 "isModuleError": true, 853 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 854 } 855 }); 856 errorlbl = ''; 857 } 858 }); 859 $('.service #wfPageNextId3').on('click', function (e) { 860 if (document.querySelector('input[name="tfa_303"]:checked') !== null) { 861 adobeDataLayer.push({ 862 "event": "click", 863 "module": { 864 "moduleName": lblname, 865 "moduleId": sfinalid, 866 "moduleType": lbltype, 867 "moduleStep": "step2", //Update step number as applicable 868 "moduleStepName": "step2", 869 "moduleQuestion": $('#tfa_196 div label.preField').attr("id"), 870 "optionSelected": document.querySelector('input[name="tfa_303"]:checked').labels[0].id 871 } 872 }); 873 } 874 else { 875 $(".wfCurrentPage .errFld").each(function () { 876 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 877 }); 878 adobeDataLayer.push({ 879 "event": "click", 880 "module": { 881 "moduleName": lblname, 882 "moduleId": sfinalid, 883 "moduleType": lbltype, 884 "moduleStep": "step2", //Update step number as applicable 885 "moduleStepName": "step2", 886 "moduleQuestion": $('#tfa_196 div label.preField').attr("id"), 887 "optionSelected": "", 888 "isModuleError": true, 889 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 890 } 891 }); 892 errorlbl = ''; 893 } 894 });
895 $('.service #wfPageNextId4').on('click', function (e) { 896 if (document.querySelector('input[name="tfa_390"]:checked') !== null) { 897 adobeDataLayer.push({ 898 "event": "click", 899 "module": { 900 "moduleName": lblname, 901 "moduleId": sfinalid, 902 "moduleType": lbltype, 903 "moduleStep": "step3", //Update step number as applicable 904 "moduleStepName": "step3", 905 "moduleQuestion": $('#tfa_389 div label.preField').attr("id"), 906 "optionSelected": document.querySelector('input[name="tfa_390"]:checked').labels[0].id 907 } 908 }); 909 } 910 else { 911 $(".wfCurrentPage .errFld").each(function () { 912 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 913 }); 914 adobeDataLayer.push({ 915 "event": "click", 916 "module": { 917 "moduleName": lblname, 918 "moduleId": sfinalid, 919 "moduleType": lbltype, 920 "moduleStep": "step3", //Update step number as applicable 921 "moduleStepName": "step3", 922 "moduleQuestion": $('#tfa_389 div label.preField').attr("id"), 923 "optionSelected": "", 924 "isModuleError": true, 925 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 926 } 927 }); 928 errorlbl = ''; 929 } 930 }); 931 $('.service #wfPageNextId5').on('click', function (e) { 932 if (document.querySelector('input[name="tfa_408"]:checked') !== null) { 933 adobeDataLayer.push({ 934 "event": "click", 935 "module": { 936 "moduleName": lblname, 937 "moduleId": sfinalid, 938 "moduleType": lbltype, 939 "moduleStep": "step4", //Update step number as applicable 940 "moduleStepName": "step4", 941 "moduleQuestion": $('#tfa_407 div label.preField').attr("id"), 942 "optionSelected": document.querySelector('input[name="tfa_408"]:checked').labels[0].id 943 } 944 }); 945 } 946 else { 947 $(".wfCurrentPage .errFld").each(function () { 948 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 949 }); 950 adobeDataLayer.push({ 951 "event": "click", 952 "module": { 953 "moduleName": lblname, 954 "moduleId": sfinalid, 955 "moduleType": lbltype, 956 "moduleStep": "step4", //Update step number as applicable 957 "moduleStepName": "step4", 958 "moduleQuestion": $('#tfa_407 div label.preField').attr("id"), 959 "optionSelected": "", 960 "isModuleError": true, 961 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 962 } 963 }); 964 errorlbl = ''; 965 } 966 }); 967 $('.service #wfPageNextId6').on('click', function (e) { 968 if (document.querySelector('input[name="tfa_132"]:checked') !== null) { 969 adobeDataLayer.push({ 970 "event": "click", 971 "module": { 972 "moduleName": lblname, 973 "moduleId": sfinalid, 974 "moduleType": lbltype, 975 "moduleStep": "step5", //Update step number as applicable 976 "moduleStepName": "step5", 977 "moduleQuestion": $('#tfa_232 div label.preField').attr("id"), 978 "optionSelected": document.querySelector('input[name="tfa_132"]:checked').labels[0].id 979 } 980 }); 981 } 982 else { 983 $(".wfCurrentPage .errFld").each(function () { 984 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 985 }); 986 adobeDataLayer.push({ 987 "event": "click", 988 "module": { 989 "moduleName": lblname, 990 "moduleId": sfinalid, 991 "moduleType": lbltype, 992 "moduleStep": "step5", //Update step number as applicable 993 "moduleStepName": "step5", 994 "moduleQuestion": $('#tfa_232 div label.preField').attr("id"), 995 "optionSelected": "", 996 "isModuleError": true, 997 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 998 } 999 }); 1000 errorlbl = ''; 1001 } 1002 });
1003 1004 //Below code should be executed on click of Next Button 1005 $('.service #wfPageNextId7').on('click', function (e) { 1006 if (document.querySelector('input[name="tfa_449"]:checked') !== null && document.querySelector('input[name="tfa_453"]:checked') !== null) { 1007 adobeDataLayer.push({ 1008 "event": "click", 1009 "module": { 1010 "moduleName": lblname, 1011 "moduleId": sfinalid, 1012 "moduleType": lbltype, 1013 "moduleStep": "step6", 1014 "moduleStepName": "Questionnaire completed", 1015 "optionSelected": document.querySelector('input[name="tfa_449"]:checked').labels[0].id, 1016 "hasEquipment": document.querySelector('input[name="tfa_453"]:checked').labels[0].id == "tfa_454-L" ? "Yes" : "No", 1017 "moduleQuestion": $('#tfa_448 div label.preField')[0].id, 1018 "comment": $('#tfa_456').val(), 1019 "isModuleComplete": true 1020 } 1021 }) 1022 1023 //Below code should be executed on form View 1024 adobeDataLayer.push({ 1025 "event": "pageView", 1026 "page": pagearray, 1027 "module": { 1028 "moduleName": lblname, 1029 "moduleId": sfinalid, 1030 "moduleType": lbltype, 1031 }, 1032 "form": { 1033 "isFormView": true, 1034 "formName": sfinalid, 1035 "formType": sfinalid, 1036 "leadType": lbltype 1037 } 1038 }) 1039 GenerateDatalayerlog(sfinalid + "| Service Lead Form Module Completed successfully!"); 1040 } 1041 else { 1042 $(".wfCurrentPage .errFld").each(function () { 1043 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 1044 }); 1045 adobeDataLayer.push({ 1046 "event": "click", 1047 "module": { 1048 "moduleName": lblname, 1049 "moduleId": sfinalid, 1050 "moduleType": lbltype, 1051 "moduleStep": "step6", 1052 "moduleStepName": "step6", 1053 "moduleQuestion": $('#tfa_152 div label.preField').attr("id"), 1054 "moduleQuestion": $('#tfa_448 div label.preField')[0].id, 1055 "comment": $('#tfa_456').val(), 1056 "isModuleError": true, 1057 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 1058 } 1059 }); 1060 errorlbl = ''; 1061 } 1062 }); 1063 //Below code should be executed as soon as user interacts with any of the field. Should be executed once. 1064 $('#wfPgIndex-8 #tfa_332').one('click', function (e) { 1065 adobeDataLayer.push({ 1066 "event": "click", 1067 "module": { 1068 "moduleName": lblname, 1069 "moduleId": sfinalid, 1070 "moduleType": lbltype 1071 }, 1072 "form": { 1073 "isFormStart": true, 1074 "formName": sfinalid, 1075 "formType": sfinalid, 1076 "leadType": lbltype 1077 } 1078 1079 }) 1080 }); 1081 //Below code should be executed on submit button click 1082 $(".service #submit_button").on('click', function () { 1083 if (($(".service #submit_button").is(":enabled"))) { 1084 setTimeout( 1085 function () { 1086 if ($('.errFld').length == 0 && $('.errMsg').length == 0) { 1087 adobeDataLayer.push({ 1088 "event": "click", 1089 "module": { 1090 "moduleName": lblname, 1091 "moduleId": sfinalid, 1092 "moduleType": lbltype 1093 }, 1094 "form": { 1095 "isFormSubmitted": true, 1096 "formName": sfinalid, 1097 "formType": sfinalid, 1098 "leadType": lbltype, 1099 "marketingPermission": $('#tfa_343').is(':checked') 1100 } 1101 }) 1102 GenerateDatalayerlog(finalid + "| Service Lead Form submitted successfully!"); 1103 } 1104 else { 1105 $("#tfa_332 .errFld").each(function () { 1106 errorlbl += $(this).find(".reqMark").text().trim() + $(this).find("select option:selected").text().trim() + ": " + $(this).find(".errMsg").text() + " | "; 1107 }); 1108 1109 adobeDataLayer.push({ 1110 "event": "click", 1111 "module": { 1112 "moduleName": lblname, 1113 "moduleId": sfinalid, 1114 "moduleType": lbltype 1115 }, 1116 "form": { 1117 "isFormError": true, 1118 "formName": sfinalid, 1119 "formType": sfinalid, 1120 "leadType": lbltype, 1121 "formErrorDetails": errorlbl.trim().slice(0, -2) 1122 } 1123 }) 1124 errorlbl = ''; 1125 } 1126 }, 1127 300); 1128 } 1129 });
1130} 1131 1132function MaintenanceLeadForm() { 1133 //Maintenance Lead Form 1134 var sformid = $('.wForm form').attr('id').toLowerCase(); 1135 sformid = sformid == 'tfa_0' ? $('#tfa_dbFormId').val() : sformid; 1136 var sfinalid = typeof (sformid) === "undefined" ? $('form header h1').text().toLowerCase() : sformid; 1137 var lblname = "Maintenance Lead Magnet"; 1138 var lbltype = "Lead Magnet"; 1139 var lblgene = "Lead Generation"; 1140 1141 $('.maintenance form').one('click', function (e) { 1142 adobeDataLayer.push({ 1143 "event": "click", 1144 "module": { 1145 "isModuleStart": true, 1146 "moduleName": lblname, 1147 "moduleId": sfinalid, 1148 "moduleType": lbltype, 1149 "moduleStepName": "Get Started", 1150 "moduleStep": "step0" 1151 } 1152 }) 1153 }); 1154 1155 //Below code should be executed on click of Next Button 1156 //Update the step number and name accordingly until step3 1157 $('.maintenance #wfPageNextId1').on('click', function (e) { 1158 if ($('#tfa_153 option:selected').val() !== '' && $('#tfa_263 option:selected').val() !== '' && $('#tfa_177 option:selected').val() !== '' && $('#tfa_187 option:selected').val() !== '') { 1159 adobeDataLayer.push({ 1160 "event": "click", 1161 "module": { 1162 "moduleName": lblname, 1163 "moduleId": sfinalid, 1164 "moduleType": lbltype, 1165 "moduleStep": "step1", 1166 "moduleStepName": "step1" 1167 } 1168 }); 1169 } 1170 else { 1171 1172 $(".wfCurrentPage .errFld").each(function () { 1173 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 1174 }); 1175 1176 adobeDataLayer.push({ 1177 "event": "click", 1178 "module": { 1179 "moduleName": lblname, 1180 "moduleId": sfinalid, 1181 "moduleType": lbltype, 1182 "moduleStep": "step1", 1183 "moduleStepName": "step1", 1184 "isModuleError": true, 1185 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 1186 } 1187 }); 1188 errorlbl = ''; 1189 } 1190 }); 1191 1192 //Below code should be executed on click of Next Button 1193 $('.maintenance #wfPageNextId2').on('click', function (e) { 1194 if ($('#tfa_273 option:selected').val() !== '' && $('#tfa_283 option:selected').val() !== '' && $('#tfa_293 option:selected').val() !== '' && $('#tfa_303 option:selected').val() !== '') { 1195 adobeDataLayer.push({ 1196 "event": "click", 1197 "module": { 1198 "moduleName": lblname, 1199 "moduleId": sfinalid, 1200 "moduleType": lbltype, 1201 "moduleStep": "step2", //Update step number as applicable 1202 "moduleStepName": "step2" 1203 } 1204 }); 1205 } 1206 else { 1207 1208 $(".wfCurrentPage .errFld").each(function () { 1209 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 1210 }); 1211 adobeDataLayer.push({ 1212 "event": "click", 1213 "module": { 1214 "moduleName": lblname, 1215 "moduleId": sfinalid, 1216 "moduleType": lbltype, 1217 "moduleStep": "step2", //Update step number as applicable 1218 "moduleStepName": "step2", 1219 "isModuleError": true, 1220 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 1221 } 1222 }); 1223 errorlbl = ''; 1224 } 1225 }); 1226 1227 //Below code should be executed on click of Next Button 1228 $('.maintenance #wfPageNextId3').on('click', function (e) { 1229 if (document.querySelector('input[name="tfa_132"]:checked') !== null) { 1230 adobeDataLayer.push({ 1231 "event": "click", 1232 "module": { 1233 "moduleName": lblname, 1234 "moduleId": sfinalid, 1235 "moduleType": lbltype, 1236 "moduleStep": "step3", 1237 "moduleStepName": "Questionnaire completed", 1238 "isModuleComplete": true, 1239 "comment": $('#tfa_255').val() 1240 } 1241 }) 1242 GenerateDatalayerlog(sfinalid + "| Maintenance Lead Form Module Completed successfully!"); 1243 } 1244 else { 1245 1246 $(".wfCurrentPage .errFld").each(function () { 1247 errorlbl += $(this).find(".reqMark").attr('id').trim() + $(this).find("select option:selected").text().trim() + ": Answer not selected | "; 1248 }); 1249 1250 adobeDataLayer.push({ 1251 "event": "click", 1252 "module": { 1253 "moduleName": lblname, 1254 "moduleId": sfinalid, 1255 "moduleType": lbltype, 1256 "moduleStep": "step3", 1257 "moduleStepName": "step3", 1258 "isModuleError": true, 1259 "moduleErrorDetails": errorlbl.trim().slice(0, -2) 1260 } 1261 }) 1262 errorlbl = ''; 1263 } 1264 });
1265 1266 //Below code should be executed on click of Next Button 1267 $('.maintenance #showform').on('click', function (e) { 1268 1269 //Below code should be executed on form View 1270 adobeDataLayer.push({ 1271 "event": "pageView", 1272 "page": pagearray, 1273 "module": { 1274 "moduleName": lblname, 1275 "moduleId": sfinalid, 1276 "moduleType": lbltype 1277 }, 1278 "form": { 1279 "isFormView": true, 1280 "formName": sfinalid, 1281 "formType": sfinalid, 1282 "leadType": lblgene 1283 } 1284 }) 1285 }); 1286 1287 //Below code should be executed as soon as user interacts with any of the field. Should be executed once. 1288 $('#wfPgIndex-5 #tfa_332').one('click', function (e) { 1289 adobeDataLayer.push({ 1290 "event": "click", 1291 "module": { 1292 "moduleName": lblname, 1293 "moduleId": sfinalid, 1294 "moduleType": lbltype 1295 }, 1296 "form": { 1297 "isFormStart": true, 1298 "formName": sfinalid, 1299 "formType": sfinalid, 1300 "leadType": lblgene 1301 } 1302 }) 1303 }); 1304 1305 //Below code should be executed on submit button click 1306 $(".maintenance #submit_button").on('click', function () { 1307 if (($(".maintenance #submit_button").is(":enabled"))) { 1308 setTimeout( 1309 function () { 1310 if ($('.errFld').length == 0 && $('.errMsg').length == 0) { 1311 adobeDataLayer.push({ 1312 "event": "click", 1313 "module": { 1314 "moduleName": lblname, 1315 "moduleId": sfinalid, 1316 "moduleType": lbltype 1317 }, 1318 "form": { 1319 "isFormSubmitted": true, 1320 "formName": sfinalid, 1321 "formType": sfinalid, 1322 "leadType": lblgene, 1323 "formTopic": "", 1324 "marketingPermission": $('#tfa_343').is(':checked') 1325 } 1326 }) 1327 GenerateDatalayerlog(finalid + "| Maintenance Lead Form submitted successfully!"); 1328 } 1329 else { 1330 1331 $(".wfCurrentPage .errFld").each(function () { 1332 errorlbl += $(this).find(".reqMark").text().trim() + $(this).find("select option:selected").text().trim() + ": " + $(this).find(".errMsg").text() + " | "; 1333 }); 1334 1335 adobeDataLayer.push({ 1336 "event": "click", 1337 "module": { 1338 "moduleName": lblname, 1339 "moduleId": sfinalid, 1340 "moduleType": lbltype 1341 }, 1342 "form": { 1343 "isFormError": true, 1344 "formName": sfinalid, 1345 "formType": sfinalid, 1346 "leadType": lblgene, 1347 "formTopic": "", 1348 "formErrorDetails": errorlbl.trim().slice(0, -2) 1349 } 1350 }) 1351 errorlbl = ''; 1352 } 1353 }, 1354 300); 1355 } 1356 }); 1357 1358 //Below code should be executed on click of Next Button 1359 $('.maintenance-thankyou-text a').on('click', function (e) { 1360 adobeDataLayer.push({ 1361 "event": "click", 1362 "module": { 1363 "moduleName": lblname, 1364 "moduleId": $(this).attr("data-formid"), 1365 "moduleType": lbltype, 1366 "moduleStepName": "Start Again" 1367 }, 1368 "cta": { 1369 "name": "Start Again", //Should be in English for all languages 1370 } 1371 }); 1372 });
1373} 1374 1375function finaltitle(title) { 1376 var ftitle = title.replace("\n", "").replace("&", "").replace("+", "").replace(/-/g, "").replace("/", "").replace(/ +/g, " ").replace(".", "").replace(/[\r\n]/gm, '').toLowerCase(); 1377 1378 if (ftitle.indexOf('<img') >= 0) { 1379 ftitle = "kone image block"; 1380 } 1381 return $.trim(ftitle); 1382} 1383 1384function AdobeCtaClick(eventtype, title) { 1385 adobeDataLayer.push({ 1386 "event": "click", 1387 "cta": { 1388 "name": title, 1389 "pageName": pagetitle 1390 } 1391 }) 1392} 1393 1394function isitfile(title) { 1395 if (typeof (title) === "undefined") { 1396 return false; 1397 } else { 1398 if (title.indexOf('jpeg') >= 0 || title.indexOf('jpg') >= 0 || title.indexOf('png') >= 0 || title.indexOf('gif') >= 0 || 1399 title.indexOf('pdf') >= 0 || title.indexOf('xlsx') >= 0 || title.indexOf('xls') >= 0 || title.indexOf('csv') >= 0) { 1400 console.log(title + '-its file'); 1401 return true; 1402 } else { 1403 return false; 1404 } 1405 } 1406} 1407 1408function GetParameterValues(param) { var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < url.length; i++) { var urlparam = url[i].split('='); if (urlparam[0] == param) { return urlparam[1] } } } 1409 1410function GenerateDatalayerlog(strlogger) { 1411 $.ajax({
1412 url: "/dlerrorlog", 1413 type: "POST", 1414 dataType: "json", 1415 contentType: "application/json; charset=utf-8", 1416 data: JSON.stringify({ logger: strlogger + "|" + $(location).attr('href') }), 1417 success: function (result) { 1418 console.log(result) 1419 }, 1420 error: function (err) { 1421 console.log(err) 1422 } 1423 }); 1424} 1425 1426function cluster(domain) { 1427 var clusterArray = { 1428 "www.kone.ae": "uae", 1429 "www.kone.at": "at", 1430 "www.kone.au": "au", 1431 "www.kone.ba": "bam", 1432 "www.kone.be": "be", 1433 "www.kone.bg": "bam", 1434 "www.kone.bh": "uae", 1435 "www.kone.ca": "us", 1436 "www.kone.ch": "ch", 1437 "www.kone.co.nz": "au", 1438 "www.kone.co.th": "sea", 1439 "www.kone.co.za": "za", 1440 "www.kone.cy": "bam", 1441 "www.kone.cz": "cz", 1442 "www.kone.de": "de", 1443 "www.kone.dk": "dk", 1444 "www.kone.ee": "fi", 1445 "www.kone.eg": "uae", 1446 "www.kone.es": "es", 1447 "www.kone.fi": "fi", 1448 "www.kone.fr": "fr", 1449 "www.kone.gr": "bam", 1450 "www.kone.hk": "hk", 1451 "www.kone.hr": "bam", 1452 "www.kone.hu": "hu", 1453 "www.kone.id": "sea", 1454 "www.kone.ie": "gb", 1455 "www.kone.ie": "ie", 1456 "www.kone.in": "in", 1457 "www.kone.is": "no", 1458 "www.kone.it": "it", 1459 "www.kone.ke": "ea", 1460 "www.kone.lt": "fi", 1461 "www.kone.lv": "fi", 1462 "www.kone.ma": "ma", 1463 "www.kone.me": "bam", 1464 "www.kone.mk": "bam", 1465 "www.kone.mx": "mx", 1466 "www.kone.my": "sea", 1467 "www.kone.nl": "nl", 1468 "www.kone.no": "no", 1469 "www.kone.om": "uae", 1470 "www.kone.ph": "sea", 1471 "www.kone.pl": "pl", 1472 "www.kone.pt": "pt", 1473 "www.kone.qa": "uae", 1474 "www.kone.ro": "bam", 1475 "www.kone.rs": "bam", 1476 "www.kone.ru": "ru", 1477 "www.kone.sa": "uae", 1478 "www.kone.se": "se", 1479 "www.kone.sg": "sea", 1480 "www.kone.si": "si", 1481 "www.kone.sk": "sk", 1482 "www.kone.tn": "ma", 1483 "www.kone.tn": "tn", 1484 "www.kone.tr": "tr", 1485 "www.kone.tw": "tw", 1486 "www.kone.ua": "ua", 1487 "www.kone.ug": "ea", 1488 "www.kone.uk": "gb", 1489 "www.kone.us": "us", 1490 "www.kone.vn": "sea", 1491 "www.kone.com": "global", 1492 "dev-preview.kone.com": "corporate", 1493 "qa-live.kone.com": "corporate", 1494 "qa-live.kone.fr": "fr" 1495 }; 1496 var cval = clusterArray[domain]; 1497 if (cval === undefined) 1498 return "global"; 1499 else 1500 return cval; 1501} 1502 1503function getCampaignData(options) { 1504 options = options || {}; 1505 1506 var campaignData = {}, 1507 utm_source = qs('utm_source'), 1508 utm_medium = qs('utm_medium'), 1509 utm_campaign = qs('utm_campaign'), 1510 utm_content = qs('utm_content'), 1511 utm_term = qs('utm_term'), 1512 gclid = qs('gclid'), 1513 pageID = pageid, 1514 replaceSpecialChar = function (a) { 1515 return a.replace(/\|/g, ''); 1516 }; 1517 1518 1519 if (utm_medium) { 1520 sessionStorage.setItem("utmmedium", utm_medium); 1521 campaignData.utm_medium = replaceSpecialChar(utm_medium); 1522 } 1523 else { 1524 var newDataValue = 'direct'; 1525 var referrer = document.referrer; // get referring domain's TLD+1 value 1526 if (referrer.indexOf('?') > 0) { 1527 console.log('Refer Data having query params'); 1528 utm_source = qsr('utm_source', referrer); 1529 utm_medium = qsr('utm_medium', referrer); 1530 utm_campaign = qsr('utm_campaign', referrer); 1531 utm_content = qsr('utm_content', referrer); 1532 utm_term = qsr('utm_term', referrer); 1533 gclid = qsr('gclid', referrer); 1534 } 1535 if (gclid) { 1536 // if gclid is found, then visitor came from Google Paid Search 1537 newDataValue = 'paid_search'; 1538 } else if (/(google|yahoo|baidu|bing|yandex)/i.test(referrer)) { 1539 // list of organic search (SEO) providers 1540 newDataValue = 'organic_search'; 1541 var m = referrer.match(/^https:\/\/[^/]+/); 1542 utm_source = m ? m[0] : "direct"; 1543 } else if (referrer && !~referrer.indexOf('kone')) { 1544 // if visitor came from another site that wasn't KONE, set as referral traffic 1545 newDataValue = 'referral'; 1546 utm_source = replaceSpecialChar(referrer); 1547 } else if (!referrer) { 1548 // if no referrer, set as direct traffic 1549 newDataValue = 'direct'; 1550 utm_source = replaceSpecialChar(newDataValue); 1551 } 1552 1553 if (!utm_medium) { 1554 1555 if (newDataValue == "direct") { 1556 var sessiondata = sessionStorage.getItem("utmmedium"); 1557 campaignData.utm_medium = replaceSpecialChar(sessiondata ? sessiondata : newDataValue); 1558 } 1559 else { 1560 sessionStorage.setItem("utmmedium", newDataValue); 1561 campaignData.utm_medium = replaceSpecialChar(newDataValue); 1562 } 1563 //var m = referrer.match(/^https:\/\/[^/]+/); 1564 //var s = m ? "&utm_source=" + m[0] : ""; 1565 //if (newDataValue.indexOf('direct') < 0) { 1566 // $("header li.contactus a").each(function () { 1567 // var $this = $(this); 1568 // var _href = $this.attr("href"); 1569 // $this.attr("href", _href + '?utm_medium=' + newDataValue + s); 1570 // });
1571 //} 1572 } 1573 else { 1574 sessionStorage.setItem("utmmedium", utm_medium); 1575 campaignData.utm_medium = replaceSpecialChar(utm_medium); 1576 } 1577 } 1578 1579 if (utm_source) { 1580 sessionStorage.setItem("utmsource", utm_source); 1581 campaignData.utm_source = replaceSpecialChar(utm_source); 1582 } 1583 else { 1584 var sessiondata = sessionStorage.getItem("utmsource"); 1585 campaignData.utm_source = replaceSpecialChar(sessiondata ? sessiondata : 'direct'); 1586 } 1587 1588 if (utm_campaign) { 1589 sessionStorage.setItem("utmcampaign", utm_campaign); 1590 campaignData.utm_campaign = replaceSpecialChar(utm_campaign); 1591 } 1592 else { 1593 var sessiondata = sessionStorage.getItem("utmcampaign"); 1594 if (sessiondata) 1595 campaignData.utm_campaign = replaceSpecialChar(sessiondata); 1596 } 1597 if (utm_content) { 1598 sessionStorage.setItem("utmcontent", utm_content); 1599 campaignData.utm_content = replaceSpecialChar(utm_content); 1600 } 1601 else { 1602 var sessiondata = sessionStorage.getItem("utmcontent"); 1603 if (sessiondata) 1604 campaignData.utm_content = replaceSpecialChar(sessiondata); 1605 } 1606 if (utm_term) { 1607 sessionStorage.setItem("utmterm", utm_term); 1608 campaignData.utm_term = replaceSpecialChar(utm_term); 1609 } 1610 else { 1611 var sessiondata = sessionStorage.getItem("utmterm"); 1612 if (sessiondata) 1613 campaignData.utm_term = replaceSpecialChar(sessiondata); 1614 } 1615 if (gclid) { 1616 sessionStorage.setItem("gclid", gclid); 1617 campaignData.gclid = replaceSpecialChar(gclid); 1618 } 1619 else { 1620 var sessiondata = sessionStorage.getItem("gclid"); 1621 if (sessiondata) 1622 campaignData.gclid = replaceSpecialChar(sessiondata); 1623 } 1624 if (pageID) { 1625 campaignData.pageID = replaceSpecialChar(pageID); 1626 } 1627 campaignData.url = replaceSpecialChar(window.location.href).split('?')[0]; 1628 1629 if (options.returnType === 'object') { 1630 return campaignData; 1631 } 1632 1633 var returnVal = []; 1634 for (var i in campaignData) { 1635 if (campaignData.hasOwnProperty(i)) { 1636 returnVal.push(i + '=' + campaignData[i]); 1637 } 1638 } 1639 returnVal = returnVal.join('|'); 1640 if (!options.hideMetaData) { 1641 returnVal = '----------DO NOT REMOVE-----------\r\nCAMPAIGN_DATA_START||' + returnVal + '||CAMPAIGN_DATA_END'; 1642 } 1643 console.log(returnVal); 1644 return returnVal; 1645}; 1646 1647function qs(key) { 1648 key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars 1649 var match = location.search.match(new RegExp("[?&]" + key + "=([^&]+)(&|$)")); 1650 return match && decodeURIComponent(match[1].replace(/\+/g, " ")); 1651} 1652 1653function qsr(name, url) { 1654 if (!url) url = window.location.href; 1655 name = name.replace(/[\[\]]/g, "\\$&"); 1656 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 1657 results = regex.exec(url); 1658 if (!results) return null; 1659 if (!results[2]) return ''; 1660 return decodeURIComponent(results[2].replace(/\+/g, " ")); 1661} 1662function getQueryParam(param) { 1663 const urlParams = new URLSearchParams(window.location.search); 1664 return urlParams.get(param); 1665} 1666function isThankYouPage() { 1667 if (document.querySelector('section.module.module-thankyou') !== null) { 1668 return true; 1669 } 1670 else { 1671 const params = new URLSearchParams(window.location.search); 1672 return params.has('formid'); 1673 } 1674}
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.